five9/definitions/assertions/calls_data_freshness.sqlx

7 lines
302 B
Plaintext

config { type: "assertion" }
select * from(
select max(timestamp) max_timestamp
from ${ref("pphe_five9_raw","calls_*")}
where _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d',current_date("Europe/Amsterdam")))
where TIMESTAMP_DIFF(max_timestamp, TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY), hour) < 0