From dbf902e5b477d5f26e01995697c678190a16cc1e Mon Sep 17 00:00:00 2001 From: Tim Kirschke <81677440+tkirschke@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:23:48 +0100 Subject: [PATCH] Fixed PARTION BY Clause in Sat v0 for Fabric --- macros/tables/fabric/sat_v0.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/tables/fabric/sat_v0.sql b/macros/tables/fabric/sat_v0.sql index 0e07a5aa..7223949c 100644 --- a/macros/tables/fabric/sat_v0.sql +++ b/macros/tables/fabric/sat_v0.sql @@ -63,7 +63,7 @@ latest_entries_in_sat_prep AS ( SELECT tgt.{{ parent_hashkey }}, tgt.{{ ns.hdiff_alias }}, - ROW_NUMBER() OVER(PARTITION BY tgt.{{ parent_hashkey|lower }} ORDER BY tgt.{{ src_ldts }} DESC) as rn + ROW_NUMBER() OVER(PARTITION BY tgt.{{ parent_hashkey }} ORDER BY tgt.{{ src_ldts }} DESC) as rn FROM {{ this }} tgt INNER JOIN distinct_incoming_hashkeys src ON tgt.{{ parent_hashkey }} = src.{{ parent_hashkey }} @@ -91,7 +91,7 @@ deduplicated_numbered_source_prep AS ( {{ parent_hashkey }}, {{ ns.hdiff_alias }}, {{ datavault4dbt.print_list(source_cols) }} - , LAG({{ ns.hdiff_alias }}) OVER(PARTITION BY {{ parent_hashkey|lower }} ORDER BY {{ src_ldts }}) as prev_hashdiff + , LAG({{ ns.hdiff_alias }}) OVER(PARTITION BY {{ parent_hashkey }} ORDER BY {{ src_ldts }}) as prev_hashdiff FROM source_data ), @@ -142,4 +142,4 @@ records_to_insert AS ( SELECT * FROM records_to_insert -{%- endmacro -%} \ No newline at end of file +{%- endmacro -%}