# Data Vault 2.0

## Purpose
Data Vault 2.0 is a modeling methodology designed for large-scale enterprise data warehouses
where parallel loading, multi-source integration, and complete auditability are priorities.
Apply this skill when full Data Vault methodology is required instead of Lean Data Vault.

## Core Table Types

### Hub
Stores the unique list of business keys for one business concept.

**Rules**:
- Insert-only.
- Contains only: hash key, business key(s), load date, record source.
- No descriptive attributes — those belong in Satellites.
- One Hub per distinct business concept (Customer, Product, Order, etc.).

**Naming**: `HUB_{BusinessConcept}` — e.g., `HUB_Customer`

### Link
Stores relationships between Hubs (business events or associations).

**Rules**:
- Insert-only.
- Contains: hash key, FK hash keys to all participating Hubs, load date, record source.
- Represents a relationship or transaction — no attributes.

**Naming**: `LNK_{Concept1}_{Concept2}` — e.g., `LNK_Customer_Order`

### Satellite
Stores descriptive attributes and history for a Hub or Link.

**Rules**:
- Insert-only.
- Contains: FK to Hub or Link (hash key), load date, load end date, record source, attributes.
- Multiple Satellites per Hub/Link are allowed — split by source system or by attribute volatility.
- Current record: load end date is NULL.

**Naming**: `SAT_{HubOrLink}_{Context}` — e.g., `SAT_Customer_Demographics`, `SAT_Customer_ContactInfo`

## Hash Keys

Data Vault 2.0 uses hash keys (MD5 or SHA1) as surrogate keys, derived deterministically
from business keys. This enables:
- Parallel loading without central key generation.
- Cross-system key comparison without lookup joins.

## Key Design Principles

- **Insert-only everywhere**: No updates, no deletes. History is always complete and auditable.
- **Parallel loading**: Hubs, Links, and Satellites have no dependencies within a batch run.
- **Multi-source integration**: The same Hub accepts feeds from multiple source systems.
- **Raw Vault vs. Business Vault**: Raw Vault contains uninterpreted source data;
  Business Vault adds computed attributes and soft rules closer to the consumption layer.

## Data Vault vs. Lean Data Vault

| Aspect | Data Vault 2.0 | Lean Data Vault |
|---|---|---|
| Complexity | Higher (3 table types) | Lower (2 table types) |
| Hash keys | Required | Optional |
| Parallel loading | Fully optimized | Partial |
| Multi-source | Native | Manageable |
| Best for | Large enterprise, many sources | Lakehouse, simpler integration |

## Anti-Patterns
- **Business logic in Hubs or Links**: Only descriptive context belongs in Satellites.
- **UPDATE/DELETE in any DV table**: Destroys the auditability guarantee.
- **Single Satellite per Hub from many sources**: Causes loading conflicts — split by source.
- **Skipping Raw Vault**: Applying business rules before persisting raw data loses the audit trail.
