-
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
[#2479] Allow unique_id to take a list #4618
Changes from all commits
aefd509
70d49df
f9eb745
b2f8e0a
acd901a
3299e57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,19 @@ | |
{%- set sql_header = config.get('sql_header', none) -%} | ||
|
||
{% if unique_key %} | ||
{% set unique_key_match %} | ||
DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }} | ||
{% endset %} | ||
{% do predicates.append(unique_key_match) %} | ||
{% if unique_key is sequence and unique_key is not mapping and unique_key is not string %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This update to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the Spark change here, @gshank maybe you can pair with @McKnight-42 or @VersusFacit on making that change. @McKnight-42 @VersusFacit - this behavior difference is something good to document in the specific adapter pages if it isn't there yet There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'll also want integration tests for Snowflake + BigQuery, to ensure this change actually achieves the desired result |
||
{% for key in unique_key %} | ||
{% set this_key_match %} | ||
DBT_INTERNAL_SOURCE.{{ key }} = DBT_INTERNAL_DEST.{{ key }} | ||
{% endset %} | ||
{% do predicates.append(this_key_match) %} | ||
{% endfor %} | ||
{% else %} | ||
{% set unique_key_match %} | ||
DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }} | ||
{% endset %} | ||
{% do predicates.append(unique_key_match) %} | ||
{% endif %} | ||
{% else %} | ||
{% do predicates.append('FALSE') %} | ||
{% endif %} | ||
|
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.
Let's make sure to add the contributor from the original PR to the changelog for v1.1:
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.
By the way, I noticed that this list option is missing from the docs here:
https://docs.getdbt.com/reference/resource-configs/unique_key#use-a-combination-of-two-columns-as-a-unique-key
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.
By the way, I noticed that this list option is missing from the docs here:
https://docs.getdbt.com/reference/resource-configs/unique_key#use-a-combination-of-two-columns-as-a-unique-key
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.
Good call @cdabel !
Just opened an issue for that here: dbt-labs/docs.getdbt.com#4642