Skip to content

Commit

Permalink
Merge pull request #163 from smitsrr/ro/add_incremental_variable
Browse files Browse the repository at this point in the history
Add incremental variable for overlap
  • Loading branch information
NiallRees authored Aug 23, 2024
2 parents 77df8e4 + da3fc04 commit 020a4ac
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .changes/5.3.1.md
Original file line number Diff line number Diff line change
@@ -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)

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'dbt_snowflake_monitoring'
version: '5.3.0'
version: '5.3.1'
config-version: 2

profile: dbt_snowflake_monitoring
Expand Down
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 020a4ac

Please sign in to comment.