Skip to content

Commit 2f24351

Browse files
authored
Merge branch 'main' into monorepo-prep
2 parents 23379d6 + b52d304 commit 2f24351

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed

dbt-athena-community/pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ classifiers = [
2222
"Programming Language :: Python :: 3.12",
2323
]
2424
# these versions should always match and they both should match the local version of dbt-athena
25-
dependencies = ["dbt-athena==1.9.0b1"]
26-
version = "1.9.0b1"
25+
dependencies = ["dbt-athena==1.9.0rc1"]
26+
version = "1.9.0rc1"
2727
[project.urls]
2828
Homepage = "https://github.com/dbt-labs/dbt-athena/dbt-athena"
2929
Documentation = "https://docs.getdbt.com"
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "1.9.0b1"
1+
version = "1.9.0rc1"

dbt-athena/src/dbt/adapters/athena/impl.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def clean_up_table(self, relation: AthenaRelation) -> None:
429429

430430
@available
431431
def generate_unique_temporary_table_suffix(self, suffix_initial: str = "__dbt_tmp") -> str:
432-
return f"{suffix_initial}_{str(uuid4())}"
432+
return f"{suffix_initial}_{str(uuid4()).replace('-', '_')}"
433433

434434
def quote(self, identifier: str) -> str:
435435
return f"{self.quote_character}{identifier}{self.quote_character}"
@@ -1209,22 +1209,21 @@ def _generate_snapshot_migration_sql(self, relation: AthenaRelation, table_colum
12091209
- Copy the content of the staging table to the final table
12101210
- Delete the staging table
12111211
"""
1212-
col_csv = f",\n{' ' * 16}".join(table_columns)
1212+
col_csv = f", \n{' ' * 16}".join(table_columns)
12131213
staging_relation = relation.incorporate(
12141214
path={"identifier": relation.identifier + "__dbt_tmp_migration_staging"}
12151215
)
12161216
ctas = dedent(
12171217
f"""\
12181218
select
1219-
{col_csv},
1219+
{col_csv} ,
12201220
dbt_snapshot_at as dbt_updated_at,
12211221
dbt_valid_from,
12221222
if(dbt_valid_to > cast('9000-01-01' as timestamp), null, dbt_valid_to) as dbt_valid_to,
12231223
dbt_scd_id
12241224
from {relation}
12251225
where dbt_change_type != 'delete'
1226-
;
1227-
"""
1226+
;"""
12281227
)
12291228
staging_sql = self.execute_macro(
12301229
"create_table_as", kwargs=dict(temporary=True, relation=staging_relation, compiled_code=ctas)

dbt-athena/src/dbt/adapters/athena/relation.py

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class AthenaRelation(BaseRelation):
3939
include_policy: Policy = field(default_factory=lambda: AthenaIncludePolicy())
4040
s3_path_table_part: Optional[str] = None
4141
detailed_table_type: Optional[str] = None # table_type option from the table Parameters in Glue Catalog
42+
require_alias: bool = False
4243

4344
def render_hive(self) -> str:
4445
"""

dbt-athena/src/dbt/include/athena/macros/materializations/models/incremental/incremental.sql

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
{% set tmp_table_suffix = '__dbt_tmp' %}
2121
{% endif %}
2222

23+
{% if unique_tmp_table_suffix == True and table_type == 'iceberg' %}
24+
{% set tmp_table_suffix = adapter.generate_unique_temporary_table_suffix() %}
25+
{% endif %}
26+
2327
{% set old_tmp_relation = adapter.get_relation(identifier=target_relation.identifier ~ tmp_table_suffix,
2428
schema=schema,
2529
database=database) %}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
from dbt.tests.adapter.empty.test_empty import BaseTestEmpty
1+
from dbt.tests.adapter.empty.test_empty import BaseTestEmpty, BaseTestEmptyInlineSourceRef
22

33

44
class TestAthenaEmpty(BaseTestEmpty):
55
pass
6+
7+
8+
class TestAthenaEmptyInlineSourceRef(BaseTestEmptyInlineSourceRef):
9+
pass

dbt-athena/tests/functional/adapter/test_unique_tmp_table_suffix.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test__unique_tmp_table_suffix(self, project, capsys):
3333
model_run_result_row_count_query = f"select count(*) as records from {project.test_schema}.{relation_name}"
3434
expected_unique_table_name_re = (
3535
r"unique_tmp_table_suffix__dbt_tmp_"
36-
r"[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}"
36+
r"[0-9a-fA-F]{8}_[0-9a-fA-F]{4}_[0-9a-fA-F]{4}_[0-9a-fA-F]{4}_[0-9a-fA-F]{12}"
3737
)
3838

3939
first_model_run = run_dbt(

0 commit comments

Comments
 (0)