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

bugfix/holidat-utc-offset #126

Merged
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
## 🚨 Breaking Change (Snowflake users) 🚨
- We have changed our identifier logic in the initial Zendesk source package to account for `group` being both a Snowflake reserved word and a source table. Given `dbt_zendesk_source` is a dependency for this package, Snowflake users will want to execute a `dbt run --full-refresh` before using the new version of the package. [PR #42](https://github.com/fivetran/dbt_zendesk_source/pull/42)

## Bug Fixes
- Updates the `int_zendesk__schedule_spine` model to convert the Holiday schedules into proper UTC values before being used in comparison with the schedule times. This ensures the holidays are properly mapped to schedules regardless of timezones.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-joemarkiewicz Since this is part of a batch release should we include a link to this specific PR and the changes introduced here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I will do the individual PR links for these since it is a batch release with multiple PRs.


## 🚀 Feature Updates 🚀
- Added `solve_time_in_calendar_minutes` and `solve_time_in_business_minutes` to our `zendesk__ticket_metrics` model, which calculates calendar and business minutes for when the ticket was in the 'new', 'open', 'hold', or 'pending' status.

## 🔎 Under the Hood 🔎
- Updated the seed files and seed file configurations for the package integration tests to align with changes in dbt_zendesk_source made in [PR #42](https://github.com/fivetran/dbt_zendesk_source/pull/42) for applying the `dbt_utils.star` macro.
- Corrected the folder structure for the `.github` folder to properly categorize the Community and Maintainer PR templates.

## Contributors
- [@cth84](https://github.com/cth84) ([PR #118](https://github.com/fivetran/dbt_zendesk/pull/118))

# dbt_zendesk v0.12.0

Expand Down
1 change: 1 addition & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: 'zendesk'
version: '0.13.0'


config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
on-run-start: '{{ fivetran_utils.empty_variable_warning("ticket_field_history_columns", "zendesk_ticket_field_history") }}'
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ integration_tests:
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
port: 5439
schema: zendesk_integration_tests_3
schema: zendesk_integration_tests_40
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: zendesk_integration_tests_3
schema: zendesk_integration_tests_40
threads: 8
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
snowflake:
Expand All @@ -33,7 +33,7 @@ integration_tests:
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
schema: zendesk_integration_tests_3
schema: zendesk_integration_tests_40
threads: 8
postgres:
type: postgres
Expand All @@ -42,13 +42,13 @@ integration_tests:
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
port: 5432
schema: zendesk_integration_tests_3
schema: zendesk_integration_tests_40
threads: 8
databricks:
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
schema: zendesk_integration_tests_3
schema: zendesk_integration_tests_40
threads: 8
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: '0.13.0'
profile: 'integration_tests'

vars:
zendesk_schema: zendesk_integration_tests_3
zendesk_schema: zendesk_integration_tests_40
zendesk_source:
zendesk_organization_identifier: "organization_data"
zendesk_schedule_identifier: "schedule_data"
Expand Down
12 changes: 7 additions & 5 deletions models/intermediate/int_zendesk__schedule_spine.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ with timezone as (
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,
-- 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
Expand All @@ -105,7 +105,7 @@ with timezone as (
-- Now we need take holiday's into consideration and perform the following transformations to account for Holidays in existing schedules
), holiday_start_end_times as (

select
select
calculate_schedules.*,
schedule_holiday.holiday_name,
schedule_holiday.holiday_start_date_at,
Expand All @@ -122,10 +122,12 @@ with timezone as (
), holiday_minutes as(

select
*,
{{ dbt.datediff("holiday_week_start", "holiday_start_date_at", "minute") }} as minutes_from_sunday_start,
{{ dbt.datediff("holiday_week_start", "holiday_end_date_at", "minute") }} as minutes_from_sunday_end
holiday_start_end_times.*,
{{ dbt.datediff("holiday_week_start", "holiday_start_date_at", "minute") }} - coalesce(timezone.standard_offset_minutes, 0) as minutes_from_sunday_start,
{{ dbt.datediff("holiday_week_start", "holiday_end_date_at", "minute") }} - coalesce(timezone.standard_offset_minutes, 0) as minutes_from_sunday_end
from holiday_start_end_times
left join timezone
on timezone.time_zone = holiday_start_end_times.time_zone

-- Determine which schedule days include a holiday
), holiday_check as (
Expand Down