From a9859bd3ffce0a4d3fed05f286218f5f2c128722 Mon Sep 17 00:00:00 2001 From: Ludwig Sewall <143494830+ludwig-solita@users.noreply.github.com> Date: Wed, 6 Mar 2024 22:48:02 +0100 Subject: [PATCH 1/3] respect-snowflake-quoting.sql Quoting isn't respected when altering Snowflake tables with non-ansi-compliant names https://github.com/dbt-labs/dbt-core/issues/8080 --- dbt/include/snowflake/macros/adapters.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt/include/snowflake/macros/adapters.sql b/dbt/include/snowflake/macros/adapters.sql index 157738187..e95d474bd 100644 --- a/dbt/include/snowflake/macros/adapters.sql +++ b/dbt/include/snowflake/macros/adapters.sql @@ -248,7 +248,7 @@ {% set sql -%} alter {{ relation_type }} {{ relation }} add column {% for column in add_columns %} - {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }} + {{ adapter.quote(column.name) }} {{ column.data_type }}{{ ',' if not loop.last }} {% endfor %} {%- endset -%} @@ -261,7 +261,7 @@ {% set sql -%} alter {{ relation_type }} {{ relation }} drop column {% for column in remove_columns %} - {{ column.name }}{{ ',' if not loop.last }} + {{ adapter.quote(column.name) }}{{ ',' if not loop.last }} {% endfor %} {%- endset -%} From a1118917b91bf52636aca1fe8d6790c35eedd19c Mon Sep 17 00:00:00 2001 From: ludwig-sewall Date: Sun, 10 Mar 2024 21:27:04 +0100 Subject: [PATCH 2/3] Added changelog entry --- .changes/unreleased/Fixes-20240310-212645.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20240310-212645.yaml diff --git a/.changes/unreleased/Fixes-20240310-212645.yaml b/.changes/unreleased/Fixes-20240310-212645.yaml new file mode 100644 index 000000000..3742eeed6 --- /dev/null +++ b/.changes/unreleased/Fixes-20240310-212645.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Quoting isn't respected when modifying existing snowflake tables +time: 2024-03-10T21:26:45.385668+01:00 +custom: + Author: ludwig-solita + Issue: "8080" From b7716c50ea97fba2738acd4f3409232e4497e442 Mon Sep 17 00:00:00 2001 From: "ludwig.sewall@schibsted.com" Date: Sun, 10 Mar 2024 21:39:33 +0100 Subject: [PATCH 3/3] Revert "Added Changelog Entry" This reverts commit f28a7a6c1203776b425862cad8d4e60bf1ac4b5d, reversing changes made to a9859bd3ffce0a4d3fed05f286218f5f2c128722. --- .changes/unreleased/Fixes-20240310-212645.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .changes/unreleased/Fixes-20240310-212645.yaml diff --git a/.changes/unreleased/Fixes-20240310-212645.yaml b/.changes/unreleased/Fixes-20240310-212645.yaml deleted file mode 100644 index 3742eeed6..000000000 --- a/.changes/unreleased/Fixes-20240310-212645.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Quoting isn't respected when modifying existing snowflake tables -time: 2024-03-10T21:26:45.385668+01:00 -custom: - Author: ludwig-solita - Issue: "8080"