Engineering · Nov 2026

Data Vault on a tiny CRM

Hubs, links and satellites built from CRM snapshots, with point-in-time and as-of queries running live in the browser.

synthetic dataData Vault 2.0DuckDBSQLPython

Task

Keep the full history of customer attributes from a source system that only ever shows its current state, without nightly full copies and without losing the moment each change happened.

Scale

A teaching sample: four customers, six orders, four daily CRM snapshots. The same pattern runs unchanged at millions of rows, because nothing in it depends on the volume.

Architecture

Source snapshots are split into a hub (one row per business key), a satellite (one row per change of attributes) and a link (orders between customers and products). Keys are MD5 hashes of business keys, so every load computes them independently.

Decisions

  • Insert only, gated by hash_diff. A satellite row is written only when the hash of all attributes changes. Four snapshots of four customers produce ten satellite rows instead of fifteen.
  • History is a query. The state on any date is the latest satellite row at or before it, QUALIFY row_number() … = 1; facts get the attributes valid at their own date with an ASOF JOIN.

Reliability

Loads are idempotent: re-running a snapshot adds nothing, because the hash diff matches. Every query on the page was first checked against DuckDB from Python.

Result

Try it below: move the date, watch tiers roll back, and run your own SQL over the vault.