This repository contains custom dbt macros that override and extend functionalities from the automate_dv package. These overrides provide enhanced Data Vault 2.0 capabilities with additional features for ghost record handling, business key support, and advanced data vault pattern implementations.
The AutomateDataVault overrides package addresses specific requirements and limitations found in the standard automate_dv package by providing:
- Enhanced Ghost Record Handling: Automatic insertion and management of ghost records for referential integrity
- Business Key Support: Extended satellite functionality with business key parameters
- Advanced PIT Capabilities: Enhanced Point-in-Time table generation with flexible date handling
- Core Business Concept (CBC) Models: Consolidated views that combine hubs, satellites, and PIT tables
- Utility Macros: Helper functions for payload management, hash key handling, and integration layers
- Hub Override: Automatically adds ghost records for missing business keys
- Satellite Override: Enhanced with business key support and ghost record handling
- Transactional Link Override: Handles ghost records in foreign key relationships
- PIT Macros: Advanced point-in-time table generation with flexible as-of-date handling
- CBC Macro: Creates business-friendly consolidated models
- Ghost Key Handling:
hk_ghost()andhk_ghost_default()for null hash key management - Payload Management:
mac_payload()andmac_payload_cols()for dynamic column handling - Integration Layer:
int()macro for metadata-driven SQL generation
- Core Business Concepts (CBC) for business user consumption
- Point-in-Time (PIT) tables for temporal data joins
- Ghost record patterns for maintaining referential integrity
- Business key preservation and handling
macros/
├── automate_dv_overrides/
│ ├── cbc.sql # Core Business Concept macro
│ ├── hub.sql # Hub with ghost records
│ ├── sat.sql # Satellite with business key support
│ ├── t_lnk.sql # Transactional link with ghost handling
│ ├── pit.sql # Point-in-Time table generation
│ ├── pit_as_of_date.sql # PIT as-of-date generation
│ ├── hk_ghost.sql # Hash key ghost handling
│ ├── hk_ghost_default.sql # Default ghost hash value
│ ├── mac_payload.sql # Payload transformation macro
│ ├── mac_payload_cols.sql # Payload column list macro
│ └── int.sql # Integration layer macro
│docs/
└── templates/ # Usage templates and examples
├── cbc_template.sql
├── hub_template.sql
├── sat_template.sql
├── pit_template.sql
└── pit_as_of_date_template.sql
The docs/templates/ directory contains comprehensive usage examples for each macro, featuring:
- YAML-based Configuration: Structured parameter definitions using
set yaml_templateapproach - Practical Examples: Real-world usage scenarios with sample data
- Best Practices: Implementation guidelines and recommendations
- Alternative Configurations: Multiple parameter combinations for different use cases
cbc_template.sql- Core Business Concept implementationhub_template.sql- Hub tables with ghost record supportsat_template.sql- Satellites with business key handlingpit_template.sql- Point-in-Time table generationpit_as_of_date_template.sql- PIT as-of-date generation
- dbt >= 1.0.0
- automate_dv package
- Appropriate data warehouse (Snowflake, BigQuery, Redshift, etc.)
Note: This repository is currently private. You will need to request a Personal Access Token (PAT) from the internal support team for the system account to access this repository.
-
Request Access: Contact the internal support team to obtain a system account PAT for accessing this private repository.
-
Add this package to your
packages.yml:
packages:
- git: "https://{{env_var('')}}@github.com/Versent/versent_dbt_automatedv_overrides_private.git"
revision: main # or specific tag/branch-
Configure your git credentials with the provided PAT before running
dbt deps. -
Run
dbt depsto install the package -
Configure required variables in your
dbt_project.yml:
vars:
bk_ghost: "ghost" # Ghost record business key value- Browse the templates in
docs/templates/to understand usage patterns - Copy relevant templates to your project
- Modify configurations to match your data sources
- Delete the config varaible "enabled = False"
- Implement the data vault patterns using the override macros
vars:
bk_ghost: "ghost" # Default ghost business key valuevars:
# Add any project-specific ghost or configuration values
custom_ghost_value: "unknown"