From 92679641cfaa58ff551d2a1ea8b9e7e5e5bd6584 Mon Sep 17 00:00:00 2001 From: Theo Kiehn <162969167+tkiehn@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:18:52 +0200 Subject: [PATCH 1/2] fix hub key renaming if there are different namings for bk and hkey in the source_model and the staging-model and there is only one source model --- macros/tables/bigquery/hub.sql | 4 ++-- macros/tables/exasol/hub.sql | 4 ++-- macros/tables/postgres/hub.sql | 4 ++-- macros/tables/redshift/hub.sql | 4 ++-- macros/tables/synapse/hub.sql | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/macros/tables/bigquery/hub.sql b/macros/tables/bigquery/hub.sql index 8576cb63..283cc94b 100644 --- a/macros/tables/bigquery/hub.sql +++ b/macros/tables/bigquery/hub.sql @@ -147,7 +147,7 @@ WITH SELECT {{ hk_column }} AS {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }}, + {{ bk }} AS {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, @@ -188,7 +188,7 @@ source_new_union AS ( {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }} AS {{ business_keys[loop.index - 1] }}, + {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, diff --git a/macros/tables/exasol/hub.sql b/macros/tables/exasol/hub.sql index af048fb0..67fea45e 100644 --- a/macros/tables/exasol/hub.sql +++ b/macros/tables/exasol/hub.sql @@ -145,7 +145,7 @@ WITH SELECT {{ hk_column }} AS {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }}, + {{ bk }} AS {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, @@ -186,7 +186,7 @@ source_new_union AS ( {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }} AS {{ business_keys[loop.index - 1] }}, + {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, diff --git a/macros/tables/postgres/hub.sql b/macros/tables/postgres/hub.sql index b4804a78..9de1667e 100644 --- a/macros/tables/postgres/hub.sql +++ b/macros/tables/postgres/hub.sql @@ -147,7 +147,7 @@ WITH SELECT {{ hk_column }} AS {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }}, + {{ bk }} AS {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, @@ -188,7 +188,7 @@ source_new_union AS ( {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }} AS {{ business_keys[loop.index - 1] }}, + {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, diff --git a/macros/tables/redshift/hub.sql b/macros/tables/redshift/hub.sql index 956db40a..dc45edf9 100644 --- a/macros/tables/redshift/hub.sql +++ b/macros/tables/redshift/hub.sql @@ -147,7 +147,7 @@ WITH SELECT {{ hk_column }} AS {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }}, + {{ bk }} AS {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, @@ -188,7 +188,7 @@ source_new_union AS ( {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }} AS {{ business_keys[loop.index - 1] }}, + {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, diff --git a/macros/tables/synapse/hub.sql b/macros/tables/synapse/hub.sql index c4d4170a..a56ada6a 100644 --- a/macros/tables/synapse/hub.sql +++ b/macros/tables/synapse/hub.sql @@ -147,7 +147,7 @@ WITH SELECT {{ hk_column }} AS {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }}, + {{ bk }} AS {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, @@ -188,7 +188,7 @@ source_new_union AS ( {{ hashkey }}, {% for bk in source_model['bk_columns'] -%} - {{ bk }} AS {{ business_keys[loop.index - 1] }}, + {{ business_keys[loop.index - 1] }}, {% endfor -%} {{ src_ldts }}, From 5a95cd00d5fb64ed97dff333ffc1b5ae947aa5e3 Mon Sep 17 00:00:00 2001 From: Tim Kirschke <81677440+tkirschke@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:43:10 +0200 Subject: [PATCH 2/2] Update README.md