You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dear all,
I would like to have the macro ma_sat_v1 take into account the ma-key(s) when generating the edts. I know that the original ma_sat_v0 is intended for use when all ma-key(s) come at the same ldts, but with our solution they simply don't. They are part of the source table's primary key, but not a business key in data vault. As not all the ma-keys have to change in the source table, we had to add the ma-key into the hashdiff to make it work as desired.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear all,
I would like to have the macro ma_sat_v1 take into account the ma-key(s) when generating the edts. I know that the original ma_sat_v0 is intended for use when all ma-key(s) come at the same ldts, but with our solution they simply don't. They are part of the source table's primary key, but not a business key in data vault. As not all the ma-keys have to change in the source table, we had to add the ma-key into the hashdiff to make it work as desired.
This would be my desired coding for Snowflake:
`{%- macro snowflake__ma_sat_v1(sat_v0, hashkey, hashdiff, ma_attribute, src_ldts, src_rsrc, ledts_alias, add_is_current_flag) -%}
{%- set end_of_all_times = datavault4dbt.end_of_all_times() -%}
{%- set timestamp_format = datavault4dbt.timestamp_format() -%}
{%- set is_current_col_alias = var('datavault4dbt.is_current_col_alias', 'IS_CURRENT') -%}
{%- set source_relation = ref(sat_v0) -%}
{%- set all_columns = datavault4dbt.source_columns(source_relation=source_relation) -%}
{%- set exclude = datavault4dbt.expand_column_list(columns=[hashkey, hashdiff, ma_attribute, src_ldts, src_rsrc]) -%}
{%- set ma_attributes = datavault4dbt.expand_column_list(columns=[ma_attribute]) -%}
{%- set source_columns_to_select = datavault4dbt.process_columns_to_select(all_columns, exclude) -%}
{{ datavault4dbt.prepend_generated_by() }}
WITH
{# Getting everything from the underlying v0 satellite. #}
source_satellite AS (
),
{# Selecting all distinct loads per hashkey and ma-key. #}
distinct_hk_ldts AS (
),
{# End-dating each ldts for each hashkey and ma-key, based on earlier ldts per hashkey and ma-key. #}
end_dated_loads AS (
),
{# End-date each source record, based on the end-date for each load. #}
end_dated_source AS (
)
SELECT *
FROM end_dated_source
{%- endmacro -%}`
Beta Was this translation helpful? Give feedback.
All reactions