data-dwh-dbt-project/macros/tests/at_least_one_null.sql
2024-12-17 19:09:54 +01:00

10 lines
295 B
SQL

{% 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 %}