diff --git a/.changes/5.4.1.md b/.changes/5.4.1.md new file mode 100644 index 0000000..3d6ef7f --- /dev/null +++ b/.changes/5.4.1.md @@ -0,0 +1,9 @@ +## dbt-snowflake-monitoring 5.4.1 - February 11, 2025 + +### Fixes + +- Fix bug in hourly_spend introduced on 5.4.0 ([#175](https://github.com/get-select/dbt-snowflake-monitoring/pull/175)) + +### Contributors +- [@fernandobrito](https://github.com/fernandobrito) (Fixes) + diff --git a/CHANGELOG.md b/CHANGELOG.md index 490e8d4..2017bb4 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.4.1 - February 11, 2025 + +### Fixes + +- Fix bug in hourly_spend introduced on 5.4.0 ([#175](https://github.com/get-select/dbt-snowflake-monitoring/pull/175)) + +### Contributors +- [@fernandobrito](https://github.com/fernandobrito) (Fixes) + + ## dbt-snowflake-monitoring 5.4.0 - February 06, 2025 ### Features diff --git a/dbt_project.yml b/dbt_project.yml index 2d1b936..0aafebe 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,5 +1,5 @@ name: 'dbt_snowflake_monitoring' -version: '5.4.0' +version: '5.4.1' config-version: 2 profile: dbt_snowflake_monitoring diff --git a/models/hourly_spend.sql b/models/hourly_spend.sql index 083007e..915f596 100644 --- a/models/hourly_spend.sql +++ b/models/hourly_spend.sql @@ -450,6 +450,11 @@ other_costs as ( left join {{ ref('daily_rates') }} as daily_rates on hour::date = daily_rates.date and _service_renamed = daily_rates.service_type + /* daily_rates can have multiple rows for the same service_type, + with different values in usage_type (eg: usage_type = "automatic clustering" or + "adjustment-automatic clustering"). We want to join only with the row where + usage_type is the same as the service_type */ + and lower(service) = daily_rates.usage_type -- Covered by their own CTEs due to more complex logic or better sources where stg_metering_history.service_type not in (