-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[CT-3431] [Feature] Add support for sql_footer
#9167
Comments
sql_footer
sql_footer
@jeremyyeo Thanks for opening, as always :)
I think we'd like to do this in a more opinionated way! Check out the conversation in: Are there any other use cases you could imagine for a more general-purpose (and less-opinionated) |
Thanks @jeremyyeo for opening this issue for me. Since I think Not sure if that feature is really needed though unless you wanted to essentially reference a session parameter set with a https://docs.getdbt.com/reference/resource-configs/sql_header#comparison-to-pre-hooks However, I like the idea of On a side note - I think column level filters mentioned here might be overkill/better suited to dedicated jinja if-else at the end of the model definition since they're dependent on the structure of the model. It wouldn't violate DRY to add those filters in on a model by model basis. Your point on partition pruning is spot on though so I'm not sure if I'm considering all the edge cases. I guess adapters could potentially implement custom sampling within partitioned objects/materializations? I'm kind of speculating at this point though, I'll leave it up to you folks 😄 |
@jomccr Thanks for the response! Could I ask what your specific use case for That makes sense to me for |
I don't actually think a |
Is this your first time submitting a feature request?
Describe the feature
Just like how we have
sql_header
- we should also support asql_footer
config. In that way, we could do something like:And have that footer be applied to all models.
Describe alternatives you've considered
In the example above - to apply the same logic you'd need to either:
Who will this benefit?
Anyone who wants to write less code - I would say the predominant use is to limit the rows just like in the example above.
Are you interested in contributing this feature?
yes
Anything else?
Should be quite straightforward I think - effectively we're going to do (2) on behalf o the users - i.e. add the equivalent of adding the headers here:
dbt-core/plugins/postgres/dbt/include/postgres/macros/adapters.sql
Lines 3 to 5 in c836b75
to the bottom - something like:
Probably other places I'm not considering.
The text was updated successfully, but these errors were encountered: