-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support transient tables on Snowflake #1252
Support transient tables on Snowflake #1252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, I like the adapter-specific configs. One thing I found surprising in here was the lack of cluster_by
/partition_by
for bigquery. Is that because we only allow those fields in config
blocks, or something?
core/dbt/adapters/base/impl.py
Outdated
@@ -110,6 +110,8 @@ class BaseAdapter(object): | |||
# This should be an implementation of BaseConnectionManager | |||
ConnectionManager = None | |||
|
|||
AdapterSpecificConfigs = set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this (and redshift/snowflake's versions of this) should be a frozenset to avoid any mutability issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's a good idea, i will update
@@ -107,7 +101,7 @@ def update_in_model_config(self, config): | |||
) | |||
current.update(value) | |||
self.in_model_config[key] = current | |||
else: # key in self.ClobberFields | |||
else: # key in self.ClobberFields or self.AdapterSpecificConfigs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to mean that adapter specific configurations will always be clobber-only. If we wanted to change that in the future, would it be easy/possible without breaking existing adapters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave this a tiny bit of thought, and I'm really not sure what an append/extend config could possibly look like for adapter configs. I think "clobber" will be the most common paradigm for new configs, but I do also like the idea of not needing to change this API in the future. I think it will be easy to just add a couple more class attributes like AdapterSpecificExtendConfigs
as the need arises, and 3rd party adapters should just inherit these attributes from the base adapter. Do you buy that? Or do you think there's a better way of doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that does sound ok, in the worst case we end up with 6 of these which isn't terrible.
I do think adapter-specific append configs are potentially pretty reasonable - as a lazy example, imagine an adapter where the underlying database supports a concept like tags. It would feel pretty natural for those to append instead of clobbering.
Really, really good point! I think this was probably an oversight when we initially added those configs, and I believe that they won't work if defined in |
@beckjake no rush, but 🏓 when you're ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
This is awesome! Thank you all. |
Closes #946
This PR adds support for transient tables on Snowflake using the
transient
config. Example usage:By default, models will be created as "transient". If users wish, they can override the setting to be
false
, which will cause these tables to participate in Snowflake's Time Travel mechanism.In addition to adding the transient config, I also ripped adapter-specific configs out of the SourceConfig class. These configs are now supplied by adapters. I think this is probably a good idea, but I'm unsure how sound my implementation is. Super open to tweaking things to make this fit nicely into the adapter plugin architecture :)