Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix join clause on hourly_spend #175

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions models/hourly_spend.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down