Skip to content

Standard Satellite v1

umattern edited this page Sep 16, 2022 · 11 revisions

This macro calculates a virtualized load end date on top of a version 0 satellite. This column is generated for usage in the PIT tables, and only virtualized to follow the insert-only approach. Usually one version 1 sat would be created for each version 0 sat. A version 1 satellite should be materialized as a view by default.

Features:

  • Calculating a virtualized load-end-date on top of a version 0 satellite
  • Enforces insert-only approach without loosing time ranges for business vault entities
Parameters Data Type Explanation
sat_v0 string Name of the underlying version 0 satellite.
hashkey string Name of the parent hashkey column inside the version 0 satellite. Would either be the hashkey of a hub or a link. Needs to be similar to the 'parent_hashkey' parameter inside the sat_v0 model.
hashdiff string Name of the hashdiff column inside the underlying version 0 satellite. Needs to be similar to the 'src_hashdiff' pararmeter inside the sat_v0 model.
src_ldts string Name of the ldts column inside the source models. Is optional, will use the global variable 'datavault4dbt.ldts_alias'. Needs to use the same column name as defined as alias inside the staging model.
src_rsrc string Name of the rsrc column inside the source models. Is optional, will use the global variable 'datavault4dbt.rsrc_alias'. Needs to use the same column name as defined as alias inside the staging model.
ledts_alias string Desired alias for the load end date column. Is optional, will use the global variable 'datavault4dbt.ledts_alias' if set here.
add_is_current_flag boolean Optional parameter to add a new column to the v1 sat based on the load end date timestamp (ledts). Default is false. If set to true it will add this is_current flag to the v1 sat. For each record this column will be set to true if the load end date time stamp is equal to the variable end of all times. If its not, then the record is not current therefore it will be set to false.

Example 1

    {{ config(materialized='view') }}

    {%- set yaml_metadata -%}
    sat_v0: 'account_v0_s'
    hashkey: 'hk_account_h'
    hashdiff: 'hd_account_s'   
    ledts_alias: 'loadenddate'
    add_is_current_flag: true
    {%- endset -%}    

    {%- set metadata_dict = fromyaml(yaml_metadata) -%}

    {%- set sat_v0 = metadata_dict['sat_v0'] -%}
    {%- set hashkey = metadata_dict['hashkey'] -%}
    {%- set hashdiff = metadata_dict['hashdiff'] -%}
    {%- set ledts_alias = metadata_dict['ledts_alias'] -%}
    {%- set add_is_current_flag = metadata_dict['add_is_current_flag'] -%}

    {{ datavault4dbt.sat_v1(sat_v0=sat_v0,
                            hashkey=hashkey,
                            hashdiff=hashdiff,
                            ledts_alias=ledts_alias,
                            add_is_current_flag=add_is_current_flag) }}

Description

With this example, a regular standard Satellite in version 1 is created. Due to the fact, that a version 1 Satellite always calculates the LoadEndDate, the two parameters ledts_alias and add_is_current_flag are set in in this macro. For detailed information on the attributes, look at the table above.
Clone this wiki locally