From 01a81bc55343f89c72c57e999d2f1bd74b4b0c26 Mon Sep 17 00:00:00 2001 From: Craig Homan Date: Tue, 24 Oct 2023 11:03:55 -0400 Subject: [PATCH 01/10] fix(int_zendesk__schedule_spine): offset holiday start/end time too --- .idea/.gitignore | 8 ++++++++ models/intermediate/int_zendesk__schedule_spine.sql | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/models/intermediate/int_zendesk__schedule_spine.sql b/models/intermediate/int_zendesk__schedule_spine.sql index f7d2ea12..8cb7b4ec 100644 --- a/models/intermediate/int_zendesk__schedule_spine.sql +++ b/models/intermediate/int_zendesk__schedule_spine.sql @@ -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 @@ -105,11 +105,11 @@ 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, - cast({{ dbt.dateadd("second", "86400", "schedule_holiday.holiday_end_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_end_date_at, -- add 24*60*60 seconds + cast({{ dbt.dateadd("minute", "offset_minutes_to_add", "schedule_holiday.holiday_start_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_start_date_at, + cast({{ dbt.dateadd("minute", "1440 - offset_minutes_to_add", "schedule_holiday.holiday_end_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_end_date_at, -- add 24*60 = 1440 minutes cast({{ dbt_date.week_start("schedule_holiday.holiday_start_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_week_start, cast({{ dbt_date.week_end("schedule_holiday.holiday_end_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_week_end from schedule_holiday From 5c3c3da8a331fe0b3fe7af1bf1769e857cb82ae9 Mon Sep 17 00:00:00 2001 From: Craig Homan <89489939+cth84@users.noreply.github.com> Date: Tue, 24 Oct 2023 11:26:18 -0400 Subject: [PATCH 02/10] delete .idea/.gitignore accidental add --- .idea/.gitignore | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml From 2213ec2f23bcd17716880b837643cbed4ce0f38d Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:56:00 -0600 Subject: [PATCH 03/10] bugfix/holidat-utc-offset --- models/intermediate/int_zendesk__schedule_spine.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/models/intermediate/int_zendesk__schedule_spine.sql b/models/intermediate/int_zendesk__schedule_spine.sql index f7d2ea12..3fb7c7b9 100644 --- a/models/intermediate/int_zendesk__schedule_spine.sql +++ b/models/intermediate/int_zendesk__schedule_spine.sql @@ -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 ( From 20c9588383112a4be8728a10c067ecde0227966e Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:14:30 -0600 Subject: [PATCH 04/10] documentation updates --- CHANGELOG.md | 8 ++++++++ dbt_project.yml | 2 +- integration_tests/dbt_project.yml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 775f99ce..bac61ebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# dbt_zendesk v0.12.1 + +## 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. + +## Contributors +- [@cth84](https://github.com/cth84) ([PR #118](https://github.com/fivetran/dbt_zendesk/pull/118)) + # dbt_zendesk v0.12.0 This release includes fixes to issues introduced in v0.11.0-v0.11.1 surrounding the incorporation of schedule holidays. diff --git a/dbt_project.yml b/dbt_project.yml index 5ea0b648..eef20a98 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,5 +1,5 @@ name: 'zendesk' -version: '0.12.0' +version: '0.12.1' config-version: 2 require-dbt-version: [">=1.3.0", "<2.0.0"] diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 435e9951..db490bd9 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -1,7 +1,7 @@ config-version: 2 name: 'zendesk_integration_tests' -version: '0.12.0' +version: '0.12.1' profile: 'integration_tests' From 9df9d9afa4f8d26cb08de6c1b70a92d8087ad8bd Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:18:06 -0600 Subject: [PATCH 05/10] github folder fix --- .../maintainer_pull_request_template.md | 0 CHANGELOG.md | 3 +++ 2 files changed, 3 insertions(+) rename .github/PULL_REQUEST_TEMPLATE/{.github/PULL_REQUEST_TEMPLATE => }/maintainer_pull_request_template.md (100%) diff --git a/.github/PULL_REQUEST_TEMPLATE/.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE/.github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md rename to .github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md diff --git a/CHANGELOG.md b/CHANGELOG.md index bac61ebb..36843bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## 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. +## Under the Hood +- 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)) From 3f5c40fc4283555cf34dc53dbfce4c1072d34686 Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:25:30 -0600 Subject: [PATCH 06/10] schema change --- integration_tests/ci/sample.profiles.yml | 10 +++++----- integration_tests/dbt_project.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/integration_tests/ci/sample.profiles.yml b/integration_tests/ci/sample.profiles.yml index c8b88918..0c6ae797 100644 --- a/integration_tests/ci/sample.profiles.yml +++ b/integration_tests/ci/sample.profiles.yml @@ -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_2 + schema: zendesk_integration_tests_3 threads: 8 bigquery: type: bigquery method: service-account-json project: 'dbt-package-testing' - schema: zendesk_integration_tests_2 + schema: zendesk_integration_tests_3 threads: 8 keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}" snowflake: @@ -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_2 + schema: zendesk_integration_tests_3 threads: 8 postgres: type: postgres @@ -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_2 + schema: zendesk_integration_tests_3 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_2 + schema: zendesk_integration_tests_3 threads: 8 token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}" type: databricks \ No newline at end of file diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index db490bd9..2d160e32 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -6,7 +6,7 @@ version: '0.12.1' profile: 'integration_tests' vars: - zendesk_schema: zendesk_integration_tests_2 + zendesk_schema: zendesk_integration_tests_3 zendesk_source: zendesk_organization_identifier: "organization_data" zendesk_schedule_identifier: "schedule_data" From 1e9aa12b025452b29ea320f1f01a8e4cce42c5e8 Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:38:13 -0600 Subject: [PATCH 07/10] merge changes --- models/intermediate/int_zendesk__schedule_spine.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/intermediate/int_zendesk__schedule_spine.sql b/models/intermediate/int_zendesk__schedule_spine.sql index 092d66bb..b242ceae 100644 --- a/models/intermediate/int_zendesk__schedule_spine.sql +++ b/models/intermediate/int_zendesk__schedule_spine.sql @@ -108,8 +108,8 @@ with timezone as ( select calculate_schedules.*, schedule_holiday.holiday_name, - cast({{ dbt.dateadd("minute", "offset_minutes_to_add", "schedule_holiday.holiday_start_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_start_date_at, - cast({{ dbt.dateadd("minute", "1440 - offset_minutes_to_add", "schedule_holiday.holiday_end_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_end_date_at, -- add 24*60 = 1440 minutes + schedule_holiday.holiday_start_date_at, + cast({{ dbt.dateadd("second", "86400", "schedule_holiday.holiday_end_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_end_date_at, -- add 24*60*60 seconds cast({{ dbt_date.week_start("schedule_holiday.holiday_start_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_week_start, cast({{ dbt_date.week_end("schedule_holiday.holiday_end_date_at") }} as {{ dbt.type_timestamp() }}) as holiday_week_end from schedule_holiday From 8440fc4d28e270310d6b165b852c963f675d2591 Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:42:11 -0600 Subject: [PATCH 08/10] requirements edit --- integration_tests/requirements.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/integration_tests/requirements.txt b/integration_tests/requirements.txt index b7702d6f..810bae10 100644 --- a/integration_tests/requirements.txt +++ b/integration_tests/requirements.txt @@ -4,6 +4,4 @@ dbt-redshift>=1.3.0,<2.0.0 dbt-postgres>=1.3.0,<2.0.0 dbt-spark>=1.3.0,<2.0.0 dbt-spark[PyHive]>=1.3.0,<2.0.0 -dbt-databricks>=1.3.0,<2.0.0 - -oscrypto @ git+https://github.com/wbond/oscrypto.git@d5f3437 \ No newline at end of file +dbt-databricks>=1.6.0,<2.0.0 \ No newline at end of file From e53475e4bcff06b7180d341f7463d07b43f765c0 Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Tue, 28 Nov 2023 09:28:03 -0600 Subject: [PATCH 09/10] schema adjustment again --- integration_tests/ci/sample.profiles.yml | 10 +++++----- integration_tests/dbt_project.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/integration_tests/ci/sample.profiles.yml b/integration_tests/ci/sample.profiles.yml index 0c6ae797..de11755e 100644 --- a/integration_tests/ci/sample.profiles.yml +++ b/integration_tests/ci/sample.profiles.yml @@ -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: @@ -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 @@ -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 \ No newline at end of file diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 4d8987e7..8ba47361 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -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" From 39f93abbc07afb1842ba83062f813a1d9aed12db Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:25:47 -0600 Subject: [PATCH 10/10] last merge conflict --- integration_tests/dbt_project.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 6e49b76d..c33d0b73 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -6,11 +6,7 @@ version: '0.13.0' profile: 'integration_tests' vars: -<<<<<<< HEAD zendesk_schema: zendesk_integration_tests_40 -======= - zendesk_schema: zendesk_integration_tests_3 ->>>>>>> release/v0.13.0 zendesk_source: zendesk_organization_identifier: "organization_data" zendesk_schedule_identifier: "schedule_data"