data-dwh-dbt-project/macros/tests/at_least_one_null.sql

11 lines
295 B
MySQL
Raw Normal View History

2024-12-17 19:09:54 +01:00
{% test at_least_one_null(model, columns) %}
select *
from {{ model }}
where
{% for column in columns %}
{{ column }} is not null {% if not loop.last %} and {% endif %}
{% endfor %}
-- If all columns are not null, the row violates the test
{% endtest %}