-
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
Feature/support incremental predicates #5702
Feature/support incremental predicates #5702
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Pls pls pls can we get this into the next minor release? For some reason I thought it would be released in 1.3.0 until I just checked! |
For those who want this now, all you have to do to get the
|
core/dbt/include/global_project/macros/materializations/models/incremental/incremental.sql
Show resolved
Hide resolved
@@ -21,7 +21,7 @@ | |||
|
|||
{% macro default__get_incremental_delete_insert_sql(arg_dict) %} | |||
|
|||
{% do return(get_delete_insert_merge_sql(arg_dict["target_relation"], arg_dict["temp_relation"], arg_dict["unique_key"], arg_dict["dest_columns"])) %} | |||
{% do return(get_delete_insert_merge_sql(arg_dict["target_relation"], arg_dict["temp_relation"], arg_dict["unique_key"], arg_dict["dest_columns"], arg_dict["incremental_predicates"])) %} |
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.
One thought is that we could maybe support both, borrowing from @NiallRees :
{% macro default__get_incremental_merge_sql(arg_dict) %}
{% if "predicates" in arg_dict %}
{% do return(get_merge_sql(arg_dict["target_relation"], arg_dict["temp_relation"], arg_dict["unique_key"], arg_dict["dest_columns"], arg_dict["predicates"])) %}
{% else %}
{% do return(get_delete_insert_merge_sql(arg_dict["target_relation"], arg_dict["temp_relation"], arg_dict["unique_key"], arg_dict["dest_columns"], arg_dict["incremental_predicates"])) %}
{% endmacro %}
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
resolves #5680
Description
This PR incorporates the feedback from @NiallRees in #5679 and builds on it for the
delete+insert
incremental strategy. There's not a ton of functional difference between the two PRs:incremental_predicates
gets passed through thearg_dict
get_delete_insert_merge_sql
for predicates in the style described by NiallIn conjunction with this PR, i added support across the other adapters that use
merge
ordelete+insert
:UPDATE - opened new PR for Snowflake adapter tests
Would love some guidance on how to coordinate these changes together (esp Databricks, since it's a forked repo!)
I made a new PR simply becuase I had the branch in motion -- I recognize this is probably to most annoying way to do this given how many versions of this PR there have been, and the fact that it's duplicative to Niall's -- many apologies! Happy to coordinate and consolidate however the team sees fit.
Checklist
changie new
to create a changelog entry