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

Handle missing remaining balance #120

Merged
merged 5 commits into from
Jun 21, 2023
Merged
Changes from 4 commits
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
16 changes: 9 additions & 7 deletions models/daily_rates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ current_account()

with
dates_base as (
select dateadd(
'day',
'-' || row_number() over (order by null),
dateadd('day', '+1', current_date)
) as date
from table(generator(rowcount => (365 * 3)))
select date_day as date from (
{{ dbt_utils.date_spine(
datepart="day",
start_date="'2018-01-01'",
end_date="dateadd(day, 1, current_date)"
)
}}
)
),

rate_sheet_daily_base as (
Expand Down Expand Up @@ -127,7 +129,7 @@ rates_w_overage as (
end as rate_priority

from base
inner join latest_remaining_balance_daily
left join latest_remaining_balance_daily on latest_remaining_balance_daily.date is not null
left join remaining_balance_daily
on base.date = remaining_balance_daily.date
left join rate_sheet_daily
Expand Down