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 b4a4ece6194..3599f2f22ae 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - 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)) + Contributors: - [@NiallRees](https://github.com/NiallRees) ([#4447](https://github.com/dbt-labs/dbt-core/pull/4447)) - [@alswang18](https://github.com/alswang18) ([#4644](https://github.com/dbt-labs/dbt-core/pull/4644)) 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 }}