From c83251660bceff29ca3d35ef96c8f8c2992558c2 Mon Sep 17 00:00:00 2001 From: Sean Rose Date: Mon, 8 Nov 2021 15:35:56 -0800 Subject: [PATCH 1/2] Remove extra semicolon in `insert_by_period` materialization. `create_table_as()` generates a SQL statement that already ends with a semicolon, so the extra semicolon after a `create_table_as()` call in the `insert_by_period` materialization ends up being an empty SQL statement, and at least when using Snowflake this causes the dbt run to fail with a "cannot unpack non-iterable NoneType object" error. --- macros/materializations/insert_by_period_materialization.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/materializations/insert_by_period_materialization.sql b/macros/materializations/insert_by_period_materialization.sql index 9b43bdbb..851afa3d 100644 --- a/macros/materializations/insert_by_period_materialization.sql +++ b/macros/materializations/insert_by_period_materialization.sql @@ -102,7 +102,7 @@ {# Create an empty target table -#} {% call statement('main') -%} {%- set empty_sql = sql | replace("__PERIOD_FILTER__", 'false') -%} - {{create_table_as(False, target_relation, empty_sql)}}; + {{create_table_as(False, target_relation, empty_sql)}} {%- endcall %} {%- endif %} From e55d888c0c56937120a271ef6e0da1734749974f Mon Sep 17 00:00:00 2001 From: Sean Rose Date: Mon, 8 Nov 2021 16:08:41 -0800 Subject: [PATCH 2/2] Update changelog for PR 439. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 150b71a2..bcea9d2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,12 @@ This is a compatibility release in preparation for `dbt-core` v1.0.0 (🎉). Whe - Bump `require-dbt-version` to have an upper bound of `'<=1.0.0'`. - Url link fixes within the README for `not_constant`, `dateadd`, `datediff` and updated the header `Logger` to `Jinja Helpers`. ([#431](https://github.com/dbt-labs/dbt-utils/pull/431)) - Fully qualified a `cte_name.*` in the `equality` test to avoid an Exasol error ([#420](https://github.com/dbt-labs/dbt-utils/pull/420)) +- Remove extra semicolon in `insert_by_period` materialization that was causing errors ([#439](https://github.com/dbt-labs/dbt-utils/pull/439)) ## Contributors: - [joemarkiewicz](https://github.com/fivetran-joemarkiewicz) - [TimoKruth](https://github.com/TimoKruth) +- [sean-rose](https://github.com/sean-rose) # dbt-utils v0.7.3