Skip to content

Commit

Permalink
Merge branch 'main' into feature/allow-on-schema-change
Browse files Browse the repository at this point in the history
  • Loading branch information
moomindani authored Aug 26, 2024
2 parents 7e8fd8d + aeea602 commit 16c5584
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## New version
- Fix session provisioning timeout and delay handling
- Add on_schema_change possibility
- Fix table materialization for Delta models

## v1.8.1
- Fix typo in README.md
Expand Down
5 changes: 4 additions & 1 deletion dbt/adapters/glue/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,14 @@ def get_relation(self, database, schema, identifier):
DatabaseName=schema,
Name=identifier
)
is_delta = response.get('Table').get("Parameters").get("spark.sql.sources.provider") == "delta"

relations = self.Relation.create(
database=schema,
schema=schema,
identifier=identifier,
type=self.relation_type_map.get(response.get("Table", {}).get("TableType", "Table"))
type=self.relation_type_map.get(response.get("Table", {}).get("TableType", "Table")),
is_delta=is_delta
)
logger.debug(f"""schema : {schema}
identifier : {identifier}
Expand Down
10 changes: 9 additions & 1 deletion dbt/include/glue/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@
{%- set file_format = config.get('file_format', validator=validation.any[basestring]) -%}
{%- set table_properties = config.get('table_properties', default={}) -%}

{%- set create_statement_string -%}
{% if file_format in ['delta', 'iceberg'] -%}
create or replace table
{%- else -%}
create table
{% endif %}
{%- endset %}

{% if temporary -%}
{{ create_temporary_view(relation, sql) }}
{%- else -%}
create table {{ relation }}
{{ create_statement_string }} {{ relation }}
{% set contract_config = config.get('contract') %}
{% if contract_config.enforced %}
{{ get_assert_columns_equivalent(sql) }}
Expand Down

0 comments on commit 16c5584

Please sign in to comment.