From 4457e42430a0af52e7294f56f6ada5ccc7a201e1 Mon Sep 17 00:00:00 2001 From: Sean Rose Date: Tue, 9 Nov 2021 15:07:07 -0800 Subject: [PATCH] Remove extra semicolon in `insert_by_period` materialization (#439) * 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. * Update changelog for PR 439. --- CHANGELOG.md | 2 ++ macros/materializations/insert_by_period_materialization.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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 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 %}