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

13 lines
279 B
SQL

{% test latest_date_is_yesterday(model, column_name) %}
with
model_max_date as (
select max({{ column_name }}) as max_date
from {{ model }}
)
select *
from model_max_date
where max_date <> current_date - 1
{% endtest %}