DBT Test: Dbt Expectations Expect Row Values To Have Recent Data S3 Access Log Events Request Time Day 1
DBT test name: dbt_expectations_expect_row_values_to_have_recent_data_s3_access_log_events_request_time__day__1
DBT details
-
Kind:
generic(expect_row_values_to_have_recent_data) -
Column under test:
request_time -
Test file: trase/data_pipeline/models/s3_monitoring/_schema_s3_monitoring.yml
-
Tags:
freshness_gate
Description
No description
Details
{{ dbt_expectations.test_expect_row_values_to_have_recent_data(**_dbt_generic_test_kwargs) }}{{ config(severity="error",tags=['freshness_gate'],alias="dbt_expectations_expect_row_va_48b522893afe7fb149f7e2be1f422219") }}
with max_recency as (
select max(cast(request_time as timestamp)) as max_timestamp
from
"trase_ducklake"."main_s3_monitoring"."s3_access_log_events"
where
-- to exclude erroneous future dates
cast(request_time as timestamp) <= cast(
cast(now() as timestamp)
at time zone 'UTC' at time zone 'UTC'
as timestamp
)
)
select
*
from
max_recency
where
-- if the row_condition excludes all rows, we need to compare against a default date
-- to avoid false negatives
coalesce(max_timestamp, cast('1970-01-01' as timestamp))
<
cast(
(cast(
cast(now() as timestamp)
at time zone 'UTC' at time zone 'UTC'
as timestamp
) + cast(-1 as bigint) * interval 1 day) as timestamp)