-
Notifications
You must be signed in to change notification settings - Fork 101
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
Fix: Spark-compatible tmp_table_suffix for incremental materializations #759
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -13,17 +13,14 @@ | |
{% set temp_schema = config.get('temp_schema') %} | ||
{% set target_relation = this.incorporate(type='table') %} | ||
{% set existing_relation = load_relation(this) %} | ||
-- If using insert_overwrite on Hive table, allow to set a unique tmp table suffix | ||
{% if unique_tmp_table_suffix == True and strategy == 'insert_overwrite' and table_type == 'hive' %} | ||
{% set tmp_table_suffix = adapter.generate_unique_temporary_table_suffix() %} | ||
-- Generate a unique tmp table suffix if required | ||
{% if unique_tmp_table_suffix == True %} | ||
{% set raw_suffix = adapter.generate_unique_temporary_table_suffix() %} | ||
{% set tmp_table_suffix = raw_suffix.replace('-', '_') %} | ||
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. please move this inside the generate_unique_temporary_table_suffix. Also, remember to adapt the functional tests, otherwise they will fail. 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. #754 was merged, therefore please remove this, as not needed anymore |
||
{% else %} | ||
{% set tmp_table_suffix = '__dbt_tmp' %} | ||
{% endif %} | ||
|
||
{% if unique_tmp_table_suffix == True and table_type == 'iceberg' %} | ||
{% set tmp_table_suffix = adapter.generate_unique_temporary_table_suffix() %} | ||
{% endif %} | ||
|
||
|
||
{% set old_tmp_relation = adapter.get_relation(identifier=target_relation.identifier ~ tmp_table_suffix, | ||
schema=schema, | ||
database=database) %} | ||
|
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.
why did you remove the check on
strategy == 'insert_overwrite' and table_type == 'hive'
?for sure we can simplify the statement checks and do something like this:
But I will avoid to don't check the strategy type.
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've some doubts about my comment, your idea might not be bad overall, but to guarantee that works as expected, consider to add some Integrations tests for different scenarios.