From 517c5a23190cf971233b59654b321b26d34d6597 Mon Sep 17 00:00:00 2001 From: Doug Beatty Date: Wed, 15 Jun 2022 10:23:52 -0600 Subject: [PATCH 1/2] Only raise "no columns found" error within `union_relations` for dbt `build` and `run` sub-commands --- macros/sql/union.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/sql/union.sql b/macros/sql/union.sql index 0d4ebccb..cb960484 100644 --- a/macros/sql/union.sql +++ b/macros/sql/union.sql @@ -60,7 +60,10 @@ {%- endfor -%} {%- set ordered_column_names = column_superset.keys() -%} + {%- set dbt_command = flags.WHICH -%} + + {% if dbt_command in ['run', 'build'] %} {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %} {%- set relations_string -%} {%- for relation in relations -%} @@ -75,6 +78,7 @@ {{ exceptions.raise_compiler_error(error_message) }} {%- endif -%} + {%- endif -%} {%- for relation in relations %} From bdb15a863a7c3bf14e95c7e2f6d06e57522f8140 Mon Sep 17 00:00:00 2001 From: Doug Beatty Date: Wed, 15 Jun 2022 12:59:20 -0600 Subject: [PATCH 2/2] Update CHANGELOG [skip ci] --- CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d524b8f3..6ea1f85a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ - +# Unreleased + + + +## Fixes +- Only raise error within `union_relations` for `build`/`run` sub-commands ([#606](https://github.com/dbt-labs/dbt-utils/issues/606), [#607](https://github.com/dbt-labs/dbt-utils/pull/607)) + + + + +## Contributors: +- [@jeremyyeo](https://github.com/jeremyyeo) (#606) + # dbt-utils v0.8.5 ## 🚨 deduplicate ([#542](https://github.com/dbt-labs/dbt-utils/pull/542), [#548](https://github.com/dbt-labs/dbt-utils/pull/548))