Skip to content

Commit

Permalink
Limit columns selected in expression_is_true if failures not stored.
Browse files Browse the repository at this point in the history
  • Loading branch information
elyobo committed Sep 25, 2022
1 parent ba7ee52 commit 71f96f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 3 additions & 1 deletion macros/generic_tests/expression_is_true.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})
Expand Down

0 comments on commit 71f96f6

Please sign in to comment.