diff --git a/CHANGELOG.md b/CHANGELOG.md index 4359fb09..bd6566c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ## New features - New feature to omit the `source_column_name` column on the `union_relations` macro ([#331](https://github.com/dbt-labs/dbt-utils/issues/331), [#624](https://github.com/dbt-labs/dbt-utils/pull/624)) +- New feature to select fewer columns in `expression_is_true` ([#683](https://github.com/dbt-labs/dbt-utils/issues/683), [#686](https://github.com/dbt-labs/dbt-utils/pull/686)) ## Fixes - Better handling of whitespaces in the star macro ([#651](https://github.com/dbt-labs/dbt-utils/pull/651)) diff --git a/macros/generic_tests/expression_is_true.sql b/macros/generic_tests/expression_is_true.sql index 611685b4..b8aa7ad4 100644 --- a/macros/generic_tests/expression_is_true.sql +++ b/macros/generic_tests/expression_is_true.sql @@ -6,12 +6,14 @@ {% macro default__test_expression_is_true(model, expression, column_name, condition) %} +{% set column_list = '*' if should_store_failures() else "1" %} + with meet_condition as ( select * from {{ model }} where {{ condition }} ) select - * + {{ column_list }} from meet_condition {% if column_name is none %} where not({{ expression }})