From 0a29878a8eb68f7df7cc5d0cd0b3f7321c2a47ec Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Wed, 22 Dec 2021 16:34:16 -0600 Subject: [PATCH] add ticket id to partition --- models/ticket_history/int_zendesk__field_history_scd.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/ticket_history/int_zendesk__field_history_scd.sql b/models/ticket_history/int_zendesk__field_history_scd.sql index 07b9dfe1..38171987 100644 --- a/models/ticket_history/int_zendesk__field_history_scd.sql +++ b/models/ticket_history/int_zendesk__field_history_scd.sql @@ -23,7 +23,7 @@ with change_data as ( ,sum(case when {{ col.name }} is null then 0 else 1 - end) over (order by ticket_id, date_day rows unbounded preceding) as {{ col.name }}_field_patition + end) over (order by ticket_id, date_day rows unbounded preceding) as {{ col.name }}_field_partition {% endfor %} from change_data @@ -36,7 +36,7 @@ with change_data as ( {% for col in ticket_columns if col.name|lower not in ['date_day','ending_day','ticket_id','ticket_day_id'] %} - ,first_value( {{ col.name }} ) over (partition by {{ col.name }}_field_patition order by valid_from asc rows between unbounded preceding and current row) as {{ col.name }} + ,first_value( {{ col.name }} ) over (partition by {{ col.name }}_field_partition, ticket_id order by valid_from asc rows between unbounded preceding and current row) as {{ col.name }} {% endfor %} from set_values