Add Assignee ID to DBT Zendesk Quickstart Model for zendesk__ticket_backlog
PlannedHello,
We would like to request adding assignee_id to the select statement in the dbt model for zendesk__ticket_backlog. Currently it is used in the join, but not included in the actual select statement. Only the assignee_name is included which can be problematic when many users have the same assignee_name.
with ticket_field_history as (
select *
from "postgres"."public_zendesk_dev"."zendesk__ticket_field_history"
), tickets as (
select *
from "postgres"."public_zendesk_dev"."stg_zendesk__ticket"
), group_names as (
select *
from "postgres"."public_zendesk_dev"."stg_zendesk__group"
), users as (
select *
from "postgres"."public_zendesk_dev"."stg_zendesk__user"
), brands as (
select *
from "postgres"."public_zendesk_dev"."stg_zendesk__brand"
--The below model is excluded if the user does not include ticket_form_id in the variable as a low percentage of accounts use ticket forms.
--If using organizations, this will be included, if not it will be ignored.
), organizations as (
select *
from "postgres"."public_zendesk_dev"."stg_zendesk__organization"
), backlog as (
select
ticket_field_history.source_relation,
ticket_field_history.date_day
,ticket_field_history.ticket_id
,ticket_field_history.status
,tickets.created_channel
--Looking at all history fields the users passed through in their dbt_project.yml file
--Standard ID field where the name can easily be joined from stg model.
,assignee.name as assignee_name
--Looking at all history fields the users passed through in their dbt_project.yml file
--All other fields are not ID's and can simply be included in the query.
,ticket_field_history.priority
from ticket_field_history
left join tickets
on tickets.ticket_id = ticket_field_history.ticket_id
and tickets.source_relation = ticket_field_history.source_relation
--Join not needed if fields is not located in variable, otherwise it is included.
left join users as assignee
on assignee.user_id = cast(ticket_field_history.assignee_id as bigint)
and assignee.source_relation = ticket_field_history.source_relation
where ticket_field_history.status not in ('closed', 'solved', 'deleted')
)
select *
from backlog-
Official comment
Hi Christopher, thanks for the feedback! This is a reasonable addition and one we're currently working on implementing. We'll share an update once it's live. In the meantime, if you'd like, you can follow its development here: https://github.com/fivetran/dbt_zendesk/pull/261
Please sign in to leave a comment.
Comments
1 comment