### Snapshot Control V0 Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/22_business-vault/24_snapshot-control/24_snapshot-control-v0.md Example of how to use the control_snap_v0 macro with specified start date and daily snapshot time. ```jinja {{ config(materialized='incremental') }} {%- set yaml_metadata -%} start_date: '2015-01-01' daily_snapshot_time: '07:30:00' {%- endset -%} {{ datavault4dbt.control_snap_v0(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Staging Macro Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/02_staging/02_staging.md An example of how to use the datavault4dbt.stage macro with various configurations. ```jinja {{ config(materialized='view') }} {%- set yaml_metadata -%} source_model: 'source_account' ldts: 'edwLoadDate' rsrc: 'edwRecordSource' hashed_columns: hk_account_h: - account_number - account_key hd_account_s: is_hashdiff: true columns: - name - address - phone - email derived_columns: conversion_duration: value: 'TIMESTAMP_DIFF(conversion_date, created_date, DAY)' datatype: 'INT64' country_isocode: value: '!GER' datatype: 'STRING' account_name: value: 'name' datatype: 'String' prejoined_columns: contractnumber: src_name: 'source_data' src_table: 'contract' bk: 'contractnumber' this_column_name: 'ContractId' ref_column_name: 'Id' master_account_key: src_name: 'source_data' src_table: 'account' bk: 'account_key' this_column_name: 'master_account_id' ref_column_name: 'Id' missing_columns: legacy_account_uuid: 'INT64' shipping_address: 'STRING' {%- endset -%} {{ datavault4dbt.stage(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Staging Macro Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/02_staging/02_staging.md An example demonstrating the usage of the datavault4dbt.stage macro with comprehensive YAML metadata. ```jinja {% set yaml_metadata -%} source_model: 'source_data': 'source_account' ldts: 'PARSE_TIMESTAMP('%Y-%m-%dT%H-%M-%S', edwLoadDate)' rsrc: "CONCAT(source_system, '||', source_object)" hashed_columns: hk_account_h: - account_number - account_key hd_account_s: is_hashdiff: true columns: - name - address - phone - email hk_account_contract_l: - account_number - account_name - contractnumber derived_columns: conversion_duration: value: 'TIMESTAMP_DIFF(conversion_date, created_date, DAY)' datatype: 'INT64' country_isocode: value: '!GER' datatype: 'STRING' account_name: value: 'name' datatype: 'String' prejoined_columns: contractnumber: src_name: 'source_data' src_table: 'contract' bk: 'contractnumber' this_column_name: 'ContractId' ref_column_name: 'Id' multi_active_config: multi_active_key: 'ma_attribute' main_hashkey_column: 'hk_test' enable_ghost_records: False {%- endset -%} {{ datavault4dbt.stage(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Installation Instructions Source: https://github.com/scalefreecom/datavault4dbt/blob/main/README.md Instructions for installing the datavault4dbt package in a dbt project. ```yaml packages: - package: scalefreecom/datavault4dbt version: ["x.x.x"] ``` -------------------------------- ### Standard Link Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/07_links/07_standard-link.md This example demonstrates the creation of a regular standard link from a single source model. ```jinja {{ config(materialized='incremental') }} {%- set yaml_metadata -%} link_hashkey: 'hk_opportunity_account_l' foreign_hashkeys: - 'hk_opportunity_h' - 'hk_account_h' source_models: stage_opportunity {%- endset -%} {{ datavault4dbt.link(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Ghost Record Configuration Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/configuration.md Example configuration for ghost record timestamps on specific platforms. ```yaml datavault4dbt: beginning_of_all_times: snowflake: "0001-01-01T00:00:01" bigquery: "0001-01-01T00-00-01" postgres: "0001-01-01 00:00:01" end_of_all_times: snowflake: "8888-12-31T23:59:59" bigquery: "8888-12-31T23-59-59" postgres: "8888-12-31 23:59:59" ``` -------------------------------- ### Standard Hub Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/06_hubs/06_standard-hub.md This example demonstrates how to use the datavault4dbt.hub macro to create a standard hub entity. It specifies the hashkey, business keys, and the source model. ```jinja {{ config(materialized='incremental') }} {%- set yaml_metadata -%} hashkey: 'hk_account_h' business_keys: - account_key - account_number source_models: stage_account {%- endset -%} {{ datavault4dbt.hub(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### ref_table example usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/reference-and-business-vault.md Example of how to use the ref_table macro. ```jinja2 {{ datavault4dbt.ref_table( yaml_metadata={ 'source_model': 'lkp_statuses' } ) }} ``` -------------------------------- ### hash_columns Example with Hashdiff Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/staging-macros.md Demonstrates a more detailed example of the hash_columns macro, including a hashdiff configuration. ```jinja2 {{ datavault4dbt.hash_columns( columns={ 'hk_account_h': ['account_number', 'account_key'], 'hd_account_s': { 'is_hashdiff': true, 'columns': ['name', 'address', 'phone', 'email'], 'use_trim': true } } ) }} ``` -------------------------------- ### Standard Satellite v0 Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/10_satellites/10_standard-satellites/10_standard-satellite-v0.md Example of creating a regular standard Satellite in version 0. ```jinja {{ config(materialized='incremental') }} {%- set yaml_metadata -%} parent_hashkey: 'hk_account_h' src_hashdiff: 'hd_account_s' src_payload: - name - address - phone - email source_model: 'stage_account' {%- endset -%} {{ datavault4dbt.sat_v0(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### First Day of Week Configuration Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/configuration.md Example configuration for the first day of the week, mapping platforms to a numerical representation (1=Monday, 2=Sunday). ```yaml datavault4dbt.first_day_of_week: snowflake: "1" # Monday bigquery: "2" # Sunday postgres: "1" # Monday redshift: "1" # Monday ``` -------------------------------- ### Hub Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/26_general-usage-notes/30_multi-source-entities/30_multi-source-entities.md Configuration example for a Hub entity loading from multiple source models, demonstrating source-specific configurations and high-level parameter influence. ```jinja source_models: - name: bk_columns: - - rsrc_static: - name: bk_columns: - - hk_column: rsrc_static: hashkey: business_keys: - - ``` -------------------------------- ### control_snap_v1 Example Usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/reference-and-business-vault.md A practical example demonstrating how to use the control_snap_v1 macro with YAML metadata. ```jinja2 {% set yaml_metadata = { 'snapshot_entity': 'MONTHLY_SNAPSHOT', 'source_model': 'calendar_months', 'snapshot_trigger_column': 'is_month_end' } %} {{ datavault4dbt.control_snap_v1(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Stage Model Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/README.md Example of creating a staging model with hashing and preparation using the stage macro. ```jinja2 {{ config(materialized='view') }} {{ datavault4dbt.stage( yaml_metadata={ 'ldts': 'load_timestamp', 'rsrc': '!SAP', 'source_model': 'raw_accounts', 'hashed_columns': { 'hk_account_h': ['account_id'], 'hd_account_s': { 'is_hashdiff': true, 'columns': ['account_name', 'account_status'] } } } ) }} ``` -------------------------------- ### Link Macro Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/core-table-macros.md Example of how to use the datavault4dbt.link macro with YAML metadata. ```jinja2 {% set yaml_metadata = { 'link_hashkey': 'hk_account_contact_l', 'foreign_hashkeys': ['hk_account_h', 'hk_contact_h'], 'source_models': { 'stage_account_contact': { 'fk_columns': ['hk_account_h', 'hk_contact_h'], 'rsrc_static': '*/SAP/AccountContact/*' }, 'stage_partner_contact': { 'fk_columns': ['hk_partner_h', 'hk_contact_h'], 'link_hk': 'hk_partner_contact_l', 'rsrc_static': '*/SALESFORCE/PartnerContact/*' } } } %} {{ datavault4dbt.link(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Sat_v1 Macro Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/core-table-macros.md Example of how to use the datavault4dbt.sat_v1 macro with YAML metadata. ```jinja2 {% set result = datavault4dbt.sat_v1( yaml_metadata=none, parent_hashkey=none, src_hashdiff=none, src_payload=none, source_model=none, src_ldts=none, src_rsrc=none, disable_hwm=false, source_is_single_batch=false, ledts=none, additional_columns=none ) %} ``` -------------------------------- ### Standard Link Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/07_links/07_standard-link.md This example demonstrates the creation of a standard link, which in this case is a multi-source link due to multiple underlying source models. ```jinja {{ config(materialized='incremental') }} {%- set yaml_metadata -%} link_hashkey: 'hk_opportunity_account_l' foreign_hashkeys: - 'hk_opportunity_h' - 'hk_account_h' source_models: - name: stage_opportunity rsrc_static: '*/SALESFORCE/Opportunity/*' - name: stage_account rsrc_static: '*/SAP/Account/*' link_hk: 'hashkey_account_opportunity' fk_columns: - hashkey_opportunity - hashkey_account {%- endset -%} {{ datavault4dbt.link(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Example 2 - Multiple Logic Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/22_business-vault/24_snapshot-control/25_snapshot-control-v1.md This example demonstrates how to configure multiple active snapshot logics with different retention periods using the control_snap_v1 macro. ```jinja {{ config(materialized='view') }} {%- set yaml_metadata -%} control_snap_v0: 'control_snap_v0' log_logic: - is_active_monthly: monthly: duration: forever - is_active_yearly: yearly: duration: forever {%- endset -%} {{ datavault4dbt.control_snap_v1(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Sat_v0 Macro Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/core-table-macros.md Example of how to use the datavault4dbt.sat_v0 macro with YAML metadata. ```jinja2 {% set result = datavault4dbt.sat_v0( yaml_metadata=none, parent_hashkey=none, src_hashdiff=none, src_payload=none, source_model=none, src_ldts=none, src_rsrc=none, disable_hwm=false, source_is_single_batch=false, additional_columns=none ) %} ``` -------------------------------- ### Example Usage of sat_v1 macro Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/core-table-macros.md This example demonstrates how to use the sat_v1 macro with provided YAML metadata. ```jinja {% set yaml_metadata = { 'parent_hashkey': 'hk_account_h', 'src_hashdiff': 'hd_account_sfdc_s', 'src_payload': ['name', 'address', 'country', 'phone', 'email'], 'source_model': 'stage_account' } %} {{ datavault4dbt.sat_v1(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Multi-Active Satellite v1 Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/10_satellites/12_multi-active-satellites/13_multi-active-satellite-v1.md Example demonstrating the usage of the ma_sat_v1 macro with specific parameters for a contact phonenumber satellite. ```jinja {{ config(materialized='view') }} {%- set yaml_metadata -%} sat_v0: 'contact_phonenumer_v0_mas' hashkey: 'hk_contact_h' hashdiff: 'hd_contact_phonenumber_mas' ma_attribute: - phone_type - iid ledts_alias: 'valid_to' add_is_current_flag: true {%- endset -%} {{ datavault4dbt.ma_sat_v1(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Reference Satellite v0 Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/17_reference-data/19_reference-satellite/19_reference-satellite-v0.md An example demonstrating the usage of the ref_sat_v0 macro with Jinja templating, including configuration and metadata definition. ```jinja {{ config(materialized='incremental', schema='Core') }} {%- set yaml_metadata -%} source_model: stg_nation parent_ref_keys: N_NATIONKEY src_hashdiff: hd_nation_rs src_payload: - N_COMMENT - N_NAME - N_REGIONKEY {%- endset -%} {{ datavault4dbt.ref_sat_v0(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Example Usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/macros/rehashing/rehash_all_rdv_entities.md This macro is recommended to be called in a new model, which allows to easily define a longer yaml. The example shows how to define the entity_yaml and then call the macro. ```sql new model 'rehash_model.sql' content: {{ config(materialized='view') }} {% set entity_yaml %} config: overwrite_hash_values: true naming_conventions: hashkey_syntax: hk_* hub_hashkey_syntax: hk_*_h link_hashkey_syntax: hk_*_l hashdiff_syntax: hd_* satellites: - name: customer_n0_s hashkey: HK_CUSTOMER_H hashdiff: HD_CUSTOMER_N_S payload: - C_ACCTBAL - C_MKTSEGMENT - C_COMMENT parent_entity: customer_h business_keys: - C_CUSTKEY - name: customer_p0_s hashkey: hk_customer_h hashdiff: hd_customer_p_s payload: - c_name - c_address - c_phone parent_entity: customer_h business_keys: - c_custkey - name: part_supplier_n0_s hashkey: hk_part_supplier_l hashdiff: hd_part_supplier_n_s payload: - ps_availqty - ps_supplycost - ps_comment parent_entity: part_supplier_l ma_satellites: - name: customer_n0_ms hashkey: HK_CUSTOMER_H hashdiff: HD_CUSTOMER_N_MS ma_keys: - O_ORDERKEY payload: - O_ORDERSTATUS - O_ORDERPRIORITY - O_CLERK - O_SHIPPRIORITY - O_COMMENT - LEGACY_ORDERKEY parent_entity: customer_h business_keys: - C_CUSTKEY nh_satellites: - name: order_customer_n_ns hashkey: HK_ORDER_CUSTOMER_NL parent_entity: order_customer_nl hubs: - name: customer_h hashkey: hk_customer_h business_keys: - c_custkey links: - name: customer_nation_l link_hashkey: hk_customer_nation_l additional_hash_input_cols: [] hub_config: - hub_hashkey: hk_customer_h hub_name: customer_h business_keys: - c_custkey - hub_hashkey: hk_nation_h hub_name: nation_h business_keys: - n_nationkey - name: order_customer_nl link_hashkey: hk_order_customer_nl additional_hash_input_cols: [] hub_config: - hub_hashkey: hk_order_h hub_name: order_h business_keys: - o_orderkey - hub_hashkey: hk_customer_h hub_name: customer_h business_keys: - c_custkey - name: supplier_nation_l link_hashkey: hk_supplier_nation_l additional_hash_input_cols: [] hub_config: - hub_hashkey: hk_supplier_h hub_name: supplier_h business_keys: - s_suppkey - hub_hashkey: hk_nation_h hub_name: nation_h business_keys: - n_nationkey - name: part_supplier_l link_hashkey: hk_part_supplier_l additional_hash_input_cols: [] hub_config: - hub_hashkey: hk_supplier_h hub_name: supplier_h business_keys: - s_suppkey - hub_hashkey: hk_part_h hub_name: part_h business_keys: - p_partkey {% endset %} {{ datavault4dbt.rehash_all_rdv_entities(entity_yaml= entity_yaml, drop_old_values=true) }} SELECT 'test' as test ``` -------------------------------- ### Example 1: Basic Staging Macro Usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/02_staging/02_staging.md This example demonstrates the basic usage of the `stage` macro, including defining source model, load date timestamp, record source, and hash keys/diffs. ```jinja {{ config(materialized='view') }} {%- set yaml_metadata -%} source_model: 'source_account' ldts: 'edwLoadDate' rsrc: 'edwRecordSource' hashed_columns: hk_account_h: - account_number - account_key hd_account_s: is_hashdiff: true columns: - name - address - phone - email {%- endset -%} {{ datavault4dbt.stage(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### source_columns Macro Usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/staging-macros.md Example of how to use the source_columns macro to get a list of column names from a source relation. ```jinja2 {{ datavault4dbt.source_columns(source_relation=source) }} ``` -------------------------------- ### Example 1: Single Source Reference Hub Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/17_reference-data/18_reference-hub/18_reference-hub.md This example demonstrates how to create a reference Hub from a single source model, specifying the reference key and source model. ```jinja {{ config(materialized='incremental', schema='Core') }} {%- set yaml_metadata -%} source_models: stg_nation ref_keys: N_NATIONKEY {%- endset -%} {{ datavault4dbt.ref_hub(yaml_metadata=yaml_metadata) }} ``` ```sql WITH src_new_1 AS ( SELECT N_NATIONKEY, ldts, rsrc FROM datavault4dbt_demo.core_Stages.stg_nation src ), earliest_ref_key_over_all_sources AS ( SELECT lcte.* FROM src_new_1 AS lcte QUALIFY ROW_NUMBER() OVER (PARTITION BY N_NATIONKEY ORDER BY ldts) = 1), records_to_insert AS ( SELECT N_NATIONKEY, ldts, rsrc FROM earliest_ref_key_over_all_sources) SELECT * FROM records_to_insert ``` -------------------------------- ### Effectivity Satellite v0 Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/10_satellites/14_effectivity-satellites/14_effectivity-satellites.md Example of how to use the eff_sat_v0 macro with specified parameters. ```jinja {{config(materialized = 'incremental')}} {%- set yaml_metadata -%} tracked_hashkey: hk_account_h is_active_alias: 'active' source_model: stage_account {%- endset -%} {{ datavault4dbt.eff_sat_v0(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Example 1: Single Logic Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/22_business-vault/24_snapshot-control/25_snapshot-control-v1.md This example demonstrates how to configure the `control_snap_v1` macro with a single logarithmic snapshot logic. It specifies daily snapshots for 3 months, weekly for 1 year, monthly for 5 years, and yearly snapshots forever. ```jinja {{ config(materialized='view') }} {%- set yaml_metadata -%} control_snap_v0: 'control_snap_v0' log_logic: daily: duration: 3 unit: 'MONTH' weekly: duration: 1 unit: 'YEAR' monthly: duration: 5 unit: 'YEAR' yearly: forever: true {%- endset -%} {{ datavault4dbt.control_snap_v1(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Hashed Columns Dictionary Example Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/types.md Example structure for the `hashed_columns` parameter, defining hashkeys and hashdiffs. ```jinja2 { 'hk_account_h': ['account_number', 'account_key'], // hashkey: list of input columns 'hd_account_s': { 'is_hashdiff': true, // required for hashdiff 'columns': ['name', 'address', 'phone', 'email'], // required, payload columns 'use_trim': true // optional, default true }, 'hd_account_status_s': { 'is_hashdiff': true, 'columns': ['status', 'status_date'] } } ``` -------------------------------- ### Example Prejoined Columns Definition Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/02_staging/03_prejoining.md An example demonstrating the definition of the prejoined_columns parameter in a dbt staging model. ```jinja prejoined_columns: - extract_columns: - id aliases: - businessid ref_model: business_raw this_column_name: ContractId ref_column_name: ContractId - extract_columns: - contractnumber - contractkey aliases: - contractnumber_pj - contractkey_pj src_name: stg_prod src_table: contract this_column_name: - contract_id - other_column ref_column_name: - id - other_column operator: OR ``` -------------------------------- ### pit example usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/reference-and-business-vault.md Example of how to use the pit macro with YAML metadata. ```jinja2 {% set yaml_metadata = { 'tracked_entity': 'hub_account', 'hashkey': 'hk_account_h', 'sat_names': ['sat_account_v1', 'sat_account_contact_v1'], 'snapshot_relation': 'control_snapshot', 'dimension_key': 'dk_account_d', 'custom_rsrc': '!BUSINESS_VAULT', 'pit_type': '!PIT' } %} {{ datavault4dbt.pit(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### ref_sat_v0 example usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/reference-and-business-vault.md Example of how to use the ref_sat_v0 macro with YAML metadata. ```jinja2 {{ datavault4dbt.ref_sat_v0( yaml_metadata={ 'parent_hashkey': 'hk_product_ref_h', 'src_hashdiff': 'hd_product_details_s', 'src_payload': ['product_name', 'product_category', 'product_price'], 'source_model': 'stage_lkp_products' } ) }} ``` -------------------------------- ### ref_hub example usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/reference-and-business-vault.md Example of how to use the ref_hub macro with YAML metadata. ```jinja2 {{ datavault4dbt.ref_hub( yaml_metadata={ 'hashkey': 'hk_product_ref_h', 'business_keys': 'product_code', 'source_model': 'lkp_products' } ) }} ``` -------------------------------- ### Example 2: Multi-Source Reference Hub Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/17_reference-data/18_reference-hub/18_reference-hub.md This example illustrates the creation of a reference Hub from multiple source models, including the definition of reference keys and static resource attributes for each source. ```jinja {{ config(materialized='incremental', schema='Core') }} {%- set yaml_metadata -%} source_models: - name: stg_nation rsrc_static: 'TPC_H_SF1.Nation' - name: stg_customers ref_keys: C_NATIONKEY rsrc_static: 'TPC_H_SF1.Customer' ref_keys: N_NATIONKEY {%- endset -%} {{ datavault4dbt.ref_hub(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Example 2: Multi-Source Record Tracking Satellite Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/10_satellites/15_record-tracking-satellites/15_record-tracking-satellites.md This example illustrates the creation of a record tracking satellite for a single hashkey ('hk_customer_h') but tracks its appearance across multiple staging models ('stg_customers' and 'stg_suppliers'). It shows how to specify source-specific static resource names ('rsrc_static') and optionally different hashkey column names ('hk_column') for each source. ```jinja {{ config(materialized='incremental') }} {%- set yaml_metadata -%} tracked_hashkey: hk_customer_h source_models: - name: stg_customers rsrc_static: 'TPC_H_SF1.Customer' - name: stg_suppliers hk_column: hk_supplier_h rsrc_static: 'TPC_H_SF1.Supplier' {%- endset -%} {{ datavault4dbt.rec_track_sat(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### Example 1: Single Source Record Tracking Satellite Source: https://github.com/scalefreecom/datavault4dbt/blob/main/docs/01_macro-instructions/10_satellites/15_record-tracking-satellites/15_record-tracking-satellites.md This example demonstrates the creation of a record tracking satellite for a single hashkey ('hk_customer_h') within a single staging model ('stg_customers'). It highlights the basic configuration for tracking a hashkey from one source. ```jinja {{ config(materialized='incremental') }} {%- set yaml_metadata -%} tracked_hashkey: hk_customer_h source_models: stg_customers {%- endset -%} {{ datavault4dbt.rec_track_sat(yaml_metadata=yaml_metadata) }} ``` -------------------------------- ### hub Example Usage Source: https://github.com/scalefreecom/datavault4dbt/blob/main/_autodocs/api-reference/core-table-macros.md Example usage of the hub macro with YAML metadata. ```jinja2 {% set yaml_metadata = { 'hashkey': 'hk_account_h', 'business_keys': ['account_key'], 'source_models': { 'stage_account': { 'bk_columns': 'account_key', 'rsrc_static': '*/SAP/Accounts/*' }, 'stage_partner': { 'bk_columns': 'partner_key', 'rsrc_static': '*/SALESFORCE/Partners/*', 'hk_column': 'hk_partner_h' } } } %} {{ datavault4dbt.hub(yaml_metadata=yaml_metadata) }} ```