-
Notifications
You must be signed in to change notification settings - Fork 29
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
Give wiggle room for selecting SLA policy names if timestamps are off by milliseconds #174
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
fivetran-jamie marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ with prod as ( | |
target, | ||
in_business_hours, | ||
sla_breach_at, | ||
round(sla_elapsed_time, -1) as sla_elapsed_time, --round to the nearest tens | ||
sla_elapsed_time, | ||
is_active_sla, | ||
is_sla_breach | ||
from {{ target.schema }}_zendesk_prod.zendesk__sla_policies | ||
|
@@ -28,7 +28,7 @@ dev as ( | |
target, | ||
in_business_hours, | ||
sla_breach_at, | ||
round(sla_elapsed_time, -1) as sla_elapsed_time, --round to the nearest tens | ||
sla_elapsed_time, | ||
is_active_sla, | ||
is_sla_breach | ||
from {{ target.schema }}_zendesk_dev.zendesk__sla_policies | ||
|
@@ -48,7 +48,7 @@ dev_not_in_prod as ( | |
select * from prod | ||
), | ||
|
||
final as ( | ||
combine as ( | ||
select | ||
*, | ||
'from prod' as source | ||
|
@@ -60,8 +60,29 @@ final as ( | |
*, | ||
'from dev' as source | ||
from dev_not_in_prod | ||
), | ||
|
||
final as ( | ||
select | ||
*, | ||
max(sla_elapsed_time) over (partition by ticket_id, metric, sla_applied_at) as max_sla_elapsed_time, | ||
min(sla_elapsed_time) over (partition by ticket_id, metric, sla_applied_at) as min_sla_elapsed_time, | ||
|
||
{# | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reminder to remove before merging! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
This is necessary for upgrading to v0.18.1, as it introduces a fix for erronesouly null sla_policy_name values. The union all will consider these distinct rows as a result | ||
Remove this and following where clause afterward | ||
#} | ||
sum(case when sla_policy_name is null then 1 else 0 end) over (partition by ticket_id, metric, sla_applied_at) = 1 as name_was_null_prior | ||
|
||
from combine | ||
{{ "where ticket_id not in " ~ var('fivetran_consistency_sla_policies_exclusion_tickets',[]) ~ "" if var('fivetran_consistency_sla_policies_exclusion_tickets',[]) }} | ||
) | ||
|
||
select * | ||
from final | ||
{{ "where ticket_id not in " ~ var('fivetran_consistency_sla_policies_exclusion_tickets',[]) ~ "" if var('fivetran_consistency_sla_policies_exclusion_tickets',[]) }} | ||
where | ||
{# Take differences in runtime into account #} | ||
max_sla_elapsed_time - min_sla_elapsed_time > 2 | ||
|
||
{# Remove after v0.18.1 #} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reminder to remove before merging! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
and NOT name_was_null_prior |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably combine the two sentences here into one, I think they were both to account for the above changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combined