Skip to content

Commit

Permalink
Update incremental.sql
Browse files Browse the repository at this point in the history
Generate a unique tmp table suffix if required for incremental materializations.
Generate Spark-compatible tmp_table_suffix for incremental materializations.
  • Loading branch information
chenp-eleos authored Nov 21, 2024
1 parent b5b2df7 commit dd2e3e6
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@
{% 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() %}
{% else %}
{% set tmp_table_suffix = '__dbt_tmp' %}
{% endif %}

{% if unique_tmp_table_suffix == True and table_type == 'iceberg' %}
-- 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('-', '_') %}
{% else %}
Expand Down

0 comments on commit dd2e3e6

Please sign in to comment.