diff --git a/models/staging/stg_query_history.sql b/models/staging/stg_query_history.sql index e7da17c..5f2dd02 100644 --- a/models/staging/stg_query_history.sql +++ b/models/staging/stg_query_history.sql @@ -76,7 +76,7 @@ from {{ source('snowflake_account_usage', 'query_history') }} {% if is_incremental() %} -- must use end time in case query hasn't completed -- add lookback window of 2 days to account for late arriving queries - where end_time > (select dateadd(day, -2, coalesce(max(end_time), '1970-01-01') ) from {{ this }}) + where end_time > (select dateadd(day, -{{ var('dbt_snowflake_monitoring_incremental_days', '2') }}, coalesce(max(end_time), '1970-01-01') ) from {{ this }}) {% endif %} order by start_time