Skip to content

Commit

Permalink
Revert pruning in at_least_one test (#922)
Browse files Browse the repository at this point in the history
* restore at_least_one to previous state

* update integration test

* restore performance optimization

* restore newline

* rerun due to potential bigquery incident

* cant reproduce locally, try once more
  • Loading branch information
katieclaiborne-duet authored Jul 8, 2024
1 parent 3ea3dad commit be74299
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
field
a
field,value
a,1
b,
4 changes: 4 additions & 0 deletions integration_tests/models/generic_tests/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ seeds:
- name: field
data_tests:
- dbt_utils.at_least_one
- name: value
data_tests:
- dbt_utils.at_least_one:
group_by_columns: ['field']
error_if: "<1"
warn_if: "<0"

- name: data_test_expression_is_true
data_tests:
Expand Down
6 changes: 4 additions & 2 deletions macros/generic_tests/at_least_one.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ from (
select
{{ select_pruned_cols }}
from {{ model }}
where {{ column_name }} is not null
limit 1
{% if group_by_columns|length() == 0 %}
where {{ column_name }} is not null
limit 1
{% endif %}
)
select
{# In TSQL, subquery aggregate columns need aliases #}
Expand Down

0 comments on commit be74299

Please sign in to comment.