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

[Feature] Improve first schedule identification #93

Open
2 of 4 tasks
fivetran-edkoo opened this issue Apr 14, 2023 · 0 comments
Open
2 of 4 tasks

[Feature] Improve first schedule identification #93

fivetran-edkoo opened this issue Apr 14, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@fivetran-edkoo
Copy link

Is there an existing feature request for this?

  • I have searched the existing issues

Describe the Feature

Current model (/fivetran-dbt/dbt_zendesk/models/intermediate/int_zendesk__ticket_schedules.sql) does the following to determine which schedule is first after the creation of the ticket

 select
    ticket.ticket_id,
    ticket.created_at as schedule_created_at,
    '{{default_schedule_id}}' as schedule_id
  from ticket
  left join ticket_schedule as first_schedule
    on first_schedule.ticket_id = ticket.ticket_id
    and {{ fivetran_utils.timestamp_add('second', -5, 'first_schedule.created_at') }} <= ticket.created_at
    and first_schedule.created_at >= ticket.created_at    
  where first_schedule.ticket_id is null

But this particular join clause uses a somewhat complicated logic to ensure we are getting the first schedule created at the time the ticket is created.

and {{ fivetran_utils.timestamp_add('second', -5, 'first_schedule.created_at') }} <= ticket.created_at and first_schedule.created_at >= ticket.created_at`

Some users have noted that this logic limits it to an = operation on the where clause as DATEADD(SECOND, -5, first_schedule.created_at)>= ticket.created_at and first_schedule.created_at <= ticket.created_at becomes = ticket.created_at by simple math.

Request to explore alternate approaches to this logic, e.g., maybe a window function might be more appropriate in identifying the first ticket schedule.

Describe alternatives you've considered

No response

Are you interested in contributing this feature?

  • Yes.
  • Yes, but I will need assistance and will schedule time during your office hours for guidance.
  • No.

Anything else?

No response

@fivetran-edkoo fivetran-edkoo added the enhancement New feature or request label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant