Adding new column test: latest_date_is_yesterday
This commit is contained in:
parent
1e89966153
commit
0f73b70942
2 changed files with 16 additions and 1 deletions
13
macros/tests/latest_date_is_yesterday.sql
Normal file
13
macros/tests/latest_date_is_yesterday.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{% 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 %}
|
||||||
|
|
@ -362,6 +362,7 @@ models:
|
||||||
It comes from int_dates_mtd logic.
|
It comes from int_dates_mtd logic.
|
||||||
tests:
|
tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
- latest_date_is_yesterday
|
||||||
|
|
||||||
- name: dimension
|
- name: dimension
|
||||||
data_type: string
|
data_type: string
|
||||||
|
|
@ -461,6 +462,7 @@ models:
|
||||||
description: The last day of the month or yesterday for historic metrics.
|
description: The last day of the month or yesterday for historic metrics.
|
||||||
tests:
|
tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
- latest_date_is_yesterday
|
||||||
|
|
||||||
- name: id_deal
|
- name: id_deal
|
||||||
data_type: character varying
|
data_type: character varying
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue