From 3cc650ff80fd93478d894c4b7e224acf5de99f4e Mon Sep 17 00:00:00 2001 From: "Carneiro, Rodrigo" Date: Tue, 19 Nov 2024 11:29:14 -0300 Subject: [PATCH 1/2] add unique temp table suffix for iceberg tables --- .../materializations/models/incremental/incremental.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql b/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql index b9f5994e..1fb079b0 100644 --- a/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql +++ b/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql @@ -20,6 +20,10 @@ {% 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) %} From 824b5afc09187fc154eab4b971108084d9f277a9 Mon Sep 17 00:00:00 2001 From: teoria Date: Tue, 19 Nov 2024 12:22:28 -0300 Subject: [PATCH 2/2] fix: remove trailing-whitespace --- .../macros/materializations/models/incremental/incremental.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql b/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql index 1fb079b0..c18ac681 100644 --- a/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql +++ b/dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql @@ -23,7 +23,7 @@ {% 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) %}