From 1f304b717f8ac9832c7262adfe25b554836bd5a8 Mon Sep 17 00:00:00 2001 From: swanderz Date: Tue, 14 Dec 2021 13:41:33 -0800 Subject: [PATCH 1/4] FEAT: new columns in snapshots for adapters w/o bools --- CHANGELOG.md | 1 + .../macros/materializations/snapshots/helpers.sql | 7 +++++++ .../macros/materializations/snapshots/strategies.sql | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4a4ece6194..3a9a5f9240a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - Add deps module README ([#4686](https://github.com/dbt-labs/dbt-core/pull/4686/)) - Initial conversion of tests to pytest ([#4690](https://github.com/dbt-labs/dbt-core/issues/4690), [#4691](https://github.com/dbt-labs/dbt-core/pull/4691)) - Fix errors in Windows for tests/functions ([#4781](https://github.com/dbt-labs/dbt-core/issues/4781), [#4767](https://github.com/dbt-labs/dbt-core/pull/4767)) +- Enable more dialects to snapshot sources with added columns, even those that don't support boolean datatypes ([#4489](https://github.com/dbt-labs/dbt-core/pull/4489)) Contributors: - [@NiallRees](https://github.com/NiallRees) ([#4447](https://github.com/dbt-labs/dbt-core/pull/4447)) diff --git a/core/dbt/include/global_project/macros/materializations/snapshots/helpers.sql b/core/dbt/include/global_project/macros/materializations/snapshots/helpers.sql index df475ac6156..2a74eeef79d 100644 --- a/core/dbt/include/global_project/macros/materializations/snapshots/helpers.sql +++ b/core/dbt/include/global_project/macros/materializations/snapshots/helpers.sql @@ -22,6 +22,13 @@ {# no-op #} {% endmacro %} +{% macro get_true_sql() %} + {{ adapter.dispatch('get_true_sql', 'dbt')() }} +{% endmacro %} + +{% macro default__get_true_sql() %} + {{ return('TRUE') }} +{% endmacro %} {% macro snapshot_staging_table(strategy, source_sql, target_relation) -%} {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }} diff --git a/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql b/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql index 9e4d7d847c4..0e15999e7bd 100644 --- a/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql +++ b/core/dbt/include/global_project/macros/materializations/snapshots/strategies.sql @@ -157,7 +157,7 @@ {%- set row_changed_expr -%} ( {%- if column_added -%} - TRUE + {{ get_true_sql() }} {%- else -%} {%- for col in check_cols -%} {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }} From 86390edbead5d043e56f8b4e02d0c2edccefd163 Mon Sep 17 00:00:00 2001 From: Matthew McKnight Date: Wed, 16 Mar 2022 09:32:47 -0500 Subject: [PATCH 2/4] trigger gha workflow From 1b292f96f42f3962727a3a7b503e95e787021eb7 Mon Sep 17 00:00:00 2001 From: Matthew McKnight Date: Wed, 16 Mar 2022 10:04:16 -0500 Subject: [PATCH 3/4] using changie to make changelog --- .changes/unreleased/Under the Hood-20220316-100305.yaml | 8 ++++++++ CHANGELOG.md | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Under the Hood-20220316-100305.yaml diff --git a/.changes/unreleased/Under the Hood-20220316-100305.yaml b/.changes/unreleased/Under the Hood-20220316-100305.yaml new file mode 100644 index 00000000000..4074b54d3e8 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20220316-100305.yaml @@ -0,0 +1,8 @@ +kind: Under the Hood +body: Enable more dialects to snapshot sources with added columns, even those that + don't support boolean datatypes +time: 2022-03-16T10:03:05.96768-05:00 +custom: + Author: McKnight-42 + Issue: "4488" + PR: "4871" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9a5f9240a..3599f2f22ae 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ - Add deps module README ([#4686](https://github.com/dbt-labs/dbt-core/pull/4686/)) - Initial conversion of tests to pytest ([#4690](https://github.com/dbt-labs/dbt-core/issues/4690), [#4691](https://github.com/dbt-labs/dbt-core/pull/4691)) - Fix errors in Windows for tests/functions ([#4781](https://github.com/dbt-labs/dbt-core/issues/4781), [#4767](https://github.com/dbt-labs/dbt-core/pull/4767)) -- Enable more dialects to snapshot sources with added columns, even those that don't support boolean datatypes ([#4489](https://github.com/dbt-labs/dbt-core/pull/4489)) + Contributors: - [@NiallRees](https://github.com/NiallRees) ([#4447](https://github.com/dbt-labs/dbt-core/pull/4447)) From d7d51d3bd453b79375329fb4eceae7357c682633 Mon Sep 17 00:00:00 2001 From: Matthew McKnight Date: Wed, 16 Mar 2022 10:13:24 -0500 Subject: [PATCH 4/4] updating to be on par with main