Skip to content

Commit

Permalink
Add incremental variable for overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
smitsrr committed Aug 23, 2024
1 parent 77df8e4 commit d979c82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/staging/stg_query_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d979c82

Please sign in to comment.