Skip to content

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


Description

No description


Details

Models

Macros

  • test_expect_row_values_to_have_recent_data
  • get_where_subquery
{{ 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)