Acme Marketing Architecture

Data Architecture (Phase C)

Data Architecture (Phase C)

Decisions: ADR 2 layering, ADR 5 integrity, ADR 6 personal data. This document holds the mutable detail.

Layer contracts in one table

Bronze Silver Gold
Purpose Immutable log of what each source said, when Typed current state and history per entity, conformed Star schema for analysis; tokenised; the published contract
Write pattern Append only MERGE (current) and SCD2 (history) by source version Rebuild per date with replaceWhere; business_event inserted if absent on a deterministic id
Readers Silver jobs, reconciliation, erasure Gold jobs, reconciliation, Data Engineering Semantic models, SQL endpoint, relay, downstream
Personal data Tokens only; the landing files before the gate hold identifiers for ≤ 7 days Tokens only Tokens only
Schema policy Schema-on-read, additive Contract in Git Versioned, allow-listed columns
Retention Mirrors the source's retention; engagement events at most 3 years (data classification, DPO to confirm) As Bronze Person-level facts 3 years, aggregates kept (same proposal); time travel 30 days
Delta settings CDF off; VACUUM 7 d CDF on; VACUUM 7 d CDF on business_event only; VACUUM 30 d; log retention 90 d; V-Order
Spark write profile Write-heavy: V-Order off, auto-compaction on, large file targets, partition by ingest date Balanced: V-Order on, adaptive execution, partition by business date, Z-order on filter columns Read-heavy: V-Order on, optimised writes with 1 GB bins, Z-order on filter columns, pre-aggregated measures
Physical home lh_restricted.bronze schema lh_restricted.silver and lh_restricted.control schemas lh_gold.gold schema (one schema-enabled lakehouse per workspace, ADR 2)

Standard provenance columns

Present on every table in every layer unless noted.

Column Type Meaning
_source string salesforce, hubspot, google_ads, … (from the source registry)
_object string Source object or report name
_batch_id string Run id of the extraction that produced the row
_window_key string Deterministic window of the extraction
_extracted_at timestamp (UTC) When the adapter received the row
_source_version string or timestamp The source's own version marker (SystemModstamp, hs_lastmodifieddate, report date)
_op string upsert, delete, snapshot, cdc_create, cdc_update, cdc_delete, webhook_nudge
_payload string Bronze only: JSON of the record as received, with identifier fields replaced by vault tokens at the gate
_payload_hash string SHA-256 of the tokenised _payload for dedupe and reconciliation (a source sample is passed through the gate before comparison)
_mode string incremental, historical, reload, replay
_built_at, _gold_schema_version timestamp, string Gold only

Partitioning and layout

Time, keys and versions

Data quality gates (per promotion)

Check Bronze → Silver Silver → Gold
Schema matches contract (additive drift allowed in Bronze only) ✔ ✔
Business key not null and unique per version ✔ ✔
Referential integrity (campaign exists for performance row, person exists for engagement) — ✔ (orphans → dim_* unknown member, counted)
Freshness within tier ✔ ✔
Row-count delta vs previous run within tolerance ✔ ✔
Anonymisation gate (landing → Bronze): every column classified, identifiers tokenised, PII scan clean ✔ (hard fail, before any Bronze write) —
Allow-list: no non-allow-listed column reaches Gold — ✔ (hard fail)
Duplicates after MERGE ✔ —

Failures write references to the offending rows (landing file, row number, check name, column; never the payload) to control.quarantine, and block only the affected partition.

Integrity and audit mechanisms (summary)

Concern from the brief Mechanism Where
Failures and retries Backoff with Retry-After; circuit breaker; cursors committed per page Adapters, control tables
Duplicate data Bronze dedupe on version and hash; Silver MERGE; Gold day-level rebuild; deterministic event_id for consumers ADR 5
Partial processing Window is landed or not; watermark advances only after full window Ledger
Missed changes Polling is the truth; daily reconciliation counts; deletion sweeps; Google Ads trailing windows ADR 3, ADR 5
Recovery and reprocessing Reload by window from source; replay from Bronze; time travel to compare ADR 5
Completeness evidence control.reconciliation_result history; row counts per layer per run Control schema
Lineage Fabric lineage view; _batch_id on every row; Purview if adopted Platform
Access audit Workspace membership reviews; Fabric audit log for restricted workspace Governance

Backup and recovery

Data flow

See diagrams/data-flow-medallion.md.