DataVault4dbt - A Comprehensive Guide

3. Macro Invocation: • The metadata_dict variable is created by parsing the YAML metadata

• The DataVault4dbt.hub macro is then called with the parsed metadata as parameters, generating the SQL code needed to create the hub table

In this example:

— The hashkey is defined as hk_account_h

— The business_keys are account_key and account_number and will also be used for the hashing

— The source_models is stage_account

— The DataVault4dbt.hub macro generates the SQL to create the account hub including the hash key, business key(s), load date and record source as well as the automatic creation of ghost records SPECIAL ASPECTS — No SQL Writing Required: One of the significant advantages of using DataVault4dbt is that you don’t have to write SQL for your raw vault entities manually. The macros generate all necessary SQL based on logical rules and the metadata defined — Pattern-Based Implementation: Since Data Vault 2.0 is pattern-based, the use of macros ensures that all entities are created consistently and adhere to best practices

DATAVAULT4DBT: A COMPREHENSIVE GUIDE © SCALEFREE INTERNATIONAL GMBH 2025

14/18

Powered by