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/sla_duplicates #67

Merged
merged 4 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# dbt_zendesk v0.8.1
## Fixes
- The `0.7.1` release of the zendesk package introduced a bug within the `zendesk__sla_policy` model that caused duplicate sla records via a [join condition](https://github.com/fivetran/dbt_zendesk/blob/v0.7.1/models/sla_policy/int_zendesk__sla_policy_applied.sql#L48). This join condition has been modified to leverage the more accurate `sla_policy_applied.valid_starting_at` field instead of the `sla_policy_applied.sla_applied_at` which changes for `first_reply_time` slas. ([#67](https://github.com/fivetran/dbt_zendesk/pull/67))
# dbt_zendesk v0.8.0
## 🚨 Breaking Changes 🚨
- The logic used to generate the `zendesk__ticket_backlog` model was updated to more accurately map backlog changes to tickets. As the underlying `zendesk__ticket_field_history` model is incremental, we recommend a `--full-refresh` after installing this latest version of the package. ([#61](https://github.com/fivetran/dbt_zendesk/pull/61))
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'zendesk'
version: '0.8.0'
version: '0.8.1'

config-version: 2
require-dbt-version: [">=1.0.0", "<2.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/run_results.json

This file was deleted.

2 changes: 1 addition & 1 deletion integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ integration_tests:
method: service-account
keyfile: "{{ env_var('GCLOUD_SERVICE_KEY_PATH') }}"
project: 'dbt-package-testing'
schema: zendesk_integration_tests
schema: zendesk_integration_test
threads: 8
snowflake:
type: snowflake
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2

name: 'zendesk_integration_tests'
version: '0.8.0'
version: '0.8.1'

profile: 'integration_tests'

Expand Down
5 changes: 3 additions & 2 deletions models/sla_policy/int_zendesk__sla_policy_applied.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ with ticket_field_history as (
select
ticket_field_history.ticket_id,
ticket.created_at as ticket_created_at,
ticket_field_history.valid_starting_at,
ticket.status as ticket_current_status,
ticket_field_history.field_name as metric,
case when ticket_field_history.field_name = 'first_reply_time' then row_number() over (partition by ticket_field_history.ticket_id, ticket_field_history.field_name order by ticket_field_history.valid_starting_at desc) else 1 end as latest_sla,
Expand All @@ -45,8 +46,8 @@ with ticket_field_history as (
from sla_policy_applied
left join sla_policy_name
on sla_policy_name.ticket_id = sla_policy_applied.ticket_id
and sla_policy_applied.sla_applied_at >= {{ fivetran_utils.timestamp_add(datepart='second', interval='-5', from_timestamp='sla_policy_name.valid_starting_at') }}
and sla_policy_applied.sla_applied_at < coalesce(sla_policy_name.valid_ending_at, {{ dbt_utils.current_timestamp() }})
and sla_policy_applied.valid_starting_at >= sla_policy_name.valid_starting_at
and sla_policy_applied.valid_starting_at < coalesce(sla_policy_name.valid_ending_at, {{ dbt_utils.current_timestamp() }})
where sla_policy_applied.latest_sla = 1
)

Expand Down