-
Notifications
You must be signed in to change notification settings - Fork 3
Standard Satellite v1
dpolatscalefree edited this page Feb 23, 2023
·
6 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. |
{{ 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) }}
-
sat_v0:
- account_v0_s: This satellite would be the version 1 satellite of the underlying version 0 data satellite for account.
-
hashkey:
- hk_account_h: The satellite would be attached to the hub account, which has the column 'hk_account_h' as a hashkey column.
-
hashdiff:
- hd_account_s: Since we recommend naming the hashdiff column similar to the name of the satellite entity, just with a prefix, this would be the hashdiff column of the data satellite for account.
-
ledts_alias:
- loadenddate: The 'ledts' column will be called 'loadenddate'
-
add_is_current_flag:
- true: This will add a new column to the v1 sat based on the load end date timestamp (ledts). 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
Table of Content
- Staging
- DV-Entities
- Hubs
- Links
- Satellites
- Standard Satellite
- Multi-Active Satellite
- Non-Historized Satellite
- Record-Tracking Satellite
- Business Vault
- PIT
- Snapshot Control
- Global Variables