Skip to content

Commit

Permalink
Merge pull request #5 from fivetran/testing_dataform
Browse files Browse the repository at this point in the history
fix bug excluding first day api calls
  • Loading branch information
fivetran-jamie authored Oct 28, 2020
2 parents b199a49 + e07a193 commit 10552d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/fivetran_log_connector_daily_api_calls.sql
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ connector_api_call_history as (
connector_api_calls.destination_name,
connector_api_calls.destination_id,
max(case
when cast(spine.date_day as timestamp) = connector_api_calls.date_day then connector_api_calls.number_of_api_calls
when spine.date_day = cast(connector_api_calls.date_day as date) then connector_api_calls.number_of_api_calls
else 0
end) as number_of_api_calls
from
spine join connector_api_calls -- can't do left join with >=
on cast(spine.date_day as timestamp) >= connector_api_calls.set_up_at
spine join connector_api_calls
on spine.date_day >= cast( {{ dbt_utils.date_trunc('day', 'connector_api_calls.set_up_at') }} as date)

group by 1,2,3,4,5,6
),
Expand Down

0 comments on commit 10552d2

Please sign in to comment.