Skip to content

Commit

Permalink
add config and move to int
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetran-catfritz committed Aug 21, 2024
1 parent 0bf297e commit 76a6b96
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions models/intermediate/int_zendesk__schedule_spine.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
End result will include `valid_from` and `valid_until` columns which we will use downstream to determine which schedule-offset to associate with each ticket (ie standard time vs daylight time)
*/

with timezones_with_dst as (
with timezone as (

select *
from {{ var('time_zone') }}

), timezones_with_dst as (

select *
from {{ ref('int_zendesk__timezones_with_dst') }}
Expand Down Expand Up @@ -40,12 +45,12 @@ with timezones_with_dst as (
schedule.end_time,
schedule.created_at,
schedule.schedule_name,
schedule.start_time - coalesce(split_timezones.offset_minutes, 0) as start_time_utc,
schedule.end_time - coalesce(split_timezones.offset_minutes, 0) as end_time_utc,
coalesce(split_timezones.offset_minutes, 0) as offset_minutes_to_add,
schedule.start_time - coalesce(timezones_with_dst.offset_minutes, 0) as start_time_utc,
schedule.end_time - coalesce(timezones_with_dst.offset_minutes, 0) as end_time_utc,
coalesce(timezones_with_dst.offset_minutes, 0) as offset_minutes_to_add,
-- we'll use these to determine which schedule version to associate tickets with
cast(split_timezones.valid_from as {{ dbt.type_timestamp() }}) as valid_from,
cast(split_timezones.valid_until as {{ dbt.type_timestamp() }}) as valid_until
cast(timezones_with_dst.valid_from as {{ dbt.type_timestamp() }}) as valid_from,
cast(timezones_with_dst.valid_until as {{ dbt.type_timestamp() }}) as valid_until

from schedule
left join timezones_with_dst
Expand Down

0 comments on commit 76a6b96

Please sign in to comment.