diff --git a/.changes/5.3.1.md b/.changes/5.3.1.md new file mode 100644 index 0000000..5ba1734 --- /dev/null +++ b/.changes/5.3.1.md @@ -0,0 +1,9 @@ +## dbt-snowflake-monitoring 5.3.1 - August 23, 2024 + +### Features + +- Add lookback variable to stg_query_history ([#163](https://github.com/get-select/dbt-snowflake-monitoring/pull/163)) + +### Contributors +- [@smitsrr](https://github.com/smitsrr) (Features) + diff --git a/CHANGELOG.md b/CHANGELOG.md index 20f45ce..8966277 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## dbt-snowflake-monitoring 5.3.1 - August 23, 2024 + +### Features + +- Add lookback variable to stg_query_history ([#163](https://github.com/get-select/dbt-snowflake-monitoring/pull/163)) + +### Contributors +- [@smitsrr](https://github.com/smitsrr) (Features) + + ## dbt-snowflake-monitoring 5.3.0 - June 15, 2024 ### Features diff --git a/dbt_project.yml b/dbt_project.yml index 06eda97..396205b 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,5 +1,5 @@ name: 'dbt_snowflake_monitoring' -version: '5.3.0' +version: '5.3.1' config-version: 2 profile: dbt_snowflake_monitoring 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