Skip to content

Commit

Permalink
Fix so that file_format and table_format config values do not require…
Browse files Browse the repository at this point in the history
… wrapping in single quotes
  • Loading branch information
damian3031 committed Dec 10, 2024
1 parent 246f9a8 commit 581ffc2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .changes/unreleased/Fixes-20241206-132238.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: Fixes
body: Fix so that file_format and table_format config values do not require wrapping
in single quotes
time: 2024-12-06T13:22:38.107177+01:00
custom:
Author: damian3031
Issue: "454"
PR: "455"
8 changes: 4 additions & 4 deletions dbt/include/trino/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
{% endset %}
{% do exceptions.raise_compiler_error(msg) %}
{%- else -%}
{%- do _properties.update({'format': file_format}) -%}
{%- do _properties.update({'format': "'" ~ file_format ~ "'"}) -%}
{%- endif -%}
{%- else -%}
{%- set _properties = {'format': file_format} -%}
{%- set _properties = {'format': "'" ~ file_format ~ "'"} -%}
{%- endif -%}
{%- endif -%}

Expand All @@ -105,10 +105,10 @@
{% endset %}
{% do exceptions.raise_compiler_error(msg) %}
{%- else -%}
{%- do _properties.update({'type': table_format}) -%}
{%- do _properties.update({'type': "'" ~ table_format ~ "'"}) -%}
{%- endif -%}
{%- else -%}
{%- set _properties = {'type': table_format} -%}
{%- set _properties = {'type': "'" ~ table_format ~ "'"} -%}
{%- endif -%}
{%- endif -%}

Expand Down
10 changes: 5 additions & 5 deletions tests/functional/adapter/test_table_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def project_config_update(self):
"name": "properties_test",
"models": {
"+materialized": "table",
"file_format": "'PARQUET'",
"file_format": "parquet",
},
}

Expand All @@ -71,7 +71,7 @@ def test_table_properties(self, project):
results, logs = run_dbt_and_capture(["--debug", "run"], expect_pass=True)
assert len(results) == 1
assert "WITH (" in logs
assert "format = 'PARQUET'" in logs
assert "format = 'parquet'" in logs


@pytest.mark.iceberg
Expand All @@ -86,7 +86,7 @@ def project_config_update(self):
"+properties": {
"format": "'PARQUET'",
},
"file_format": "'ORC'",
"file_format": "orc",
},
}

Expand Down Expand Up @@ -116,7 +116,7 @@ def project_config_update(self):
"name": "properties_test",
"models": {
"+materialized": "table",
"table_format": "'iceberg'",
"table_format": "iceberg",
},
}

Expand Down Expand Up @@ -147,7 +147,7 @@ def project_config_update(self):
"+properties": {
"type": "'iceberg'",
},
"table_format": "'iceberg'",
"table_format": "iceberg",
},
}

Expand Down

0 comments on commit 581ffc2

Please sign in to comment.