From 6e4ca0bd09df08bc31702c2ed35209eca12c40c1 Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Mon, 15 Jan 2024 17:49:47 +0000 Subject: [PATCH 1/2] Switch to table --- models/staging/stg_metering_history.sql | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/models/staging/stg_metering_history.sql b/models/staging/stg_metering_history.sql index ca8c3d1..1816b59 100644 --- a/models/staging/stg_metering_history.sql +++ b/models/staging/stg_metering_history.sql @@ -1,6 +1,5 @@ {{ config( - materialized='incremental', - unique_key=['service_type', 'start_time', 'entity_id'], + materialized='table' ) }} select @@ -13,10 +12,4 @@ select credits_used_cloud_services, credits_used from {{ source('snowflake_account_usage', 'metering_history') }} - -{% if is_incremental() %} - -- account for changing metering data - where end_time > (select coalesce(dateadd(day, -7, max(end_time)), '1970-01-01') from {{ this }}) -{% endif %} - order by start_time asc From 24979f092bd2b9342c9c731028c7c9ea92fffd35 Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Mon, 15 Jan 2024 17:51:08 +0000 Subject: [PATCH 2/2] Changelog --- .changes/5.0.1.md | 7 +++++++ CHANGELOG.md | 10 ++++++++-- dbt_project.yml | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .changes/5.0.1.md diff --git a/.changes/5.0.1.md b/.changes/5.0.1.md new file mode 100644 index 0000000..dba36b7 --- /dev/null +++ b/.changes/5.0.1.md @@ -0,0 +1,7 @@ +## dbt-snowflake-monitoring 5.0.1 - January 15, 2024 + +### Fixes + +- Switch stg_metering_history to a table incrementalization to handle natural dupes ([#142](https://github.com/get-select/dbt-snowflake-monitoring/pull/142)) + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 6051d49..90ff556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ 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.0.1 - January 15, 2024 + +### Fixes + +- Switch stg_metering_history to a table incrementalization to handle natural dupes ([#142](https://github.com/get-select/dbt-snowflake-monitoring/pull/142)) + + + ## dbt-snowflake-monitoring 5.0.0 - January 14, 2024 ### Features @@ -24,8 +32,6 @@ To upgrade from 4.x.x, you'll need to full refresh the `stg_metering_history` mo ### Contributors - [@ernestoongaro](https://github.com/ernestoongaro) (Fixes) - - ## dbt-snowflake-monitoring 4.6.0 - November 09, 2023 ### Features diff --git a/dbt_project.yml b/dbt_project.yml index 92a3303..4a505d6 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,5 +1,5 @@ name: 'dbt_snowflake_monitoring' -version: '5.0.0' +version: '5.0.1' config-version: 2 profile: dbt_snowflake_monitoring