Skip to content

Fix!: Exclude redundant keys from the config attribute in dbt models#1294

Merged
izeigerman merged 1 commit intomainfrom
dbt-remove-redundant-config-attrs
Aug 10, 2023
Merged

Fix!: Exclude redundant keys from the config attribute in dbt models#1294
izeigerman merged 1 commit intomainfrom
dbt-remove-redundant-config-attrs

Conversation

@izeigerman
Copy link
Contributor

Amount of data in the config attribute of the sushi.customer_revenue_by_day model before the fix: 10KB
After the fix: 1.5KB

@izeigerman izeigerman requested a review from crericha August 10, 2023 18:47
quote_identifiers=True,
):
parsed_snapshot = json.loads(snapshot)
jinja_macros_global_objs = parsed_snapshot["node"]["jinja_macros"]["global_objs"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this dict always exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does

jinja_macros_global_objs["config"], dict
):
for key in CONFIG_ATTRIBUTE_KEYS_TO_REMOVE:
jinja_macros_global_objs["config"].pop(key, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this migration necessary? won't it get cleaned up eventually on it's own

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, but what's the point of keeping this dead baggage in the database? Plus I don't think we want to trigger a plan diff

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it trigger one? doesn't migrate rows handle it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migrate rows reads from the same state, as opposed to a local state, so I don't see how it would help here.

Copy link
Contributor

@crericha crericha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement!

@izeigerman izeigerman merged commit a39cbf2 into main Aug 10, 2023
@izeigerman izeigerman deleted the dbt-remove-redundant-config-attrs branch August 10, 2023 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants