VAYULearn
Colour theme
Investigate a failure
VAYU Learn

Databricks & Lakehouse

Medallion Architecture: Bronze → Silver → Gold in Production Reality

DataForge Series: Databricks Data Engineer Associate - Part 7 of 16

Databricks & LakehouseData Architecture & Reliability

The Gold table has been producing wrong revenue numbers for eleven days.

You trace it upstream. The Gold aggregation logic is correct. The Silver join is correct. You go to Bronze. The Bronze table has been appending duplicates since the ingestion pipeline was restarted eleven days ago — a checkpoint issue that caused Auto Loader to re-process three days of files. The Bronze data is wrong. Everything built on top of it is wrong.

The pipeline had no data quality checks at Bronze. No row count validation. No duplicate detection. The duplicates propagated through Silver unchanged — because Silver’s transformation logic doesn’t deduplicate by default. Gold aggregated the duplicates and reported inflated revenue.

Eleven days of wrong numbers. Zero errors. Zero alerts. Just a revenue dashboard that was quietly lying.

This is what Medallion architecture failure looks like in production — not a crash at one layer, but a silent contamination that flows through all three. Understanding how to prevent it requires understanding what each layer is actually responsible for — and where the boundaries between them must be enforced, not assumed.

Let’s go deep.


TL;DR

The Medallion architecture organizes data into three layers — Bronze (raw), Silver (cleaned), Gold (aggregated/served) — each with distinct quality contracts and transformation responsibilities. The architecture is only as reliable as the quality enforcement at each layer boundary. Without explicit validation, bad data doesn’t stop at Bronze. It flows downstream, compounding silently.

By the end of this article you’ll be able to:

  • Define the quality contract for each layer and what happens when it’s violated
  • Implement data quality checks and validation rules that enforce Silver and Gold reliability
  • Choose correctly between materialized views, views, streaming tables, and managed tables for Gold layer objects
  • Reason through the exam’s data quality and layer design scenarios by understanding what each layer is responsible for

Exam relevance: Medallion architecture concepts appear across ~5–7 questions covering layer responsibilities, Gold layer object types, data quality enforcement, and pipeline design. The exam tests whether you understand the purpose of each layer — not just that three layers exist.

Medallion architecture only works when layer contracts are enforced. Bronze absorbs everything — duplicates included. Silver’s quality gates determine what reaches Gold. Without them, bad data doesn’t stop. It compounds.

The Three-Layer Contract

The Medallion architecture is not just a naming convention. Each layer has a specific contract — what it guarantees about the data it contains and what it doesn’t.

Layer      Contract                    Responsibility
─────────────────────────────────────────────────────────────────────
Bronze Completeness over Land everything exactly as
correctness it arrived. No transformation.
No filtering. Replayable.

Silver Correctness over Clean, deduplicate, type-cast,
completeness validate. May drop or quarantine
bad records. Conformed schema.

Gold Fitness for purpose Aggregated, enriched, and
structured for specific
consumers (BI, ML, APIs).
Optimized for query patterns.

The failure pattern that breaks this: treating the layers as arbitrary staging areas rather than enforced contracts. Bronze tables that get overwritten lose their replay capability. Silver tables without quality rules silently pass bad data. Gold tables built for one consumer that get used for another break when the schema changes for the original consumer.

Each layer boundary is a quality gate. Gates that aren’t enforced aren’t gates.


Bronze: Completeness Is the Only Guarantee

Bronze is your system of record for raw data. Its job is to capture everything that arrived — exactly as it arrived — in a way that can be replayed if downstream processing produced wrong results.

# Bronze ingestion — append only, minimal transformation
df_raw = spark.readStream \
.format("cloudFiles") \
.option("cloudFiles.format", "json") \
.option("cloudFiles.schemaEvolutionMode", "addNewColumns") \
.option("cloudFiles.schemaLocation", "s3://bucket/checkpoints/bronze/schema") \
.load("s3://bucket/raw/events/")

# Add ingestion metadata — when and how this record arrived
from pyspark.sql.functions import current_timestamp, input_file_name

df_bronze = df_raw \
.withColumn("_ingested_at", current_timestamp()) \
.withColumn("_source_file", input_file_name())

df_bronze.writeStream \
.format("delta") \
.option("checkpointLocation", "s3://bucket/checkpoints/bronze/stream") \
.outputMode("append") \
.trigger(availableNow=True) \
.start("s3://bucket/delta/bronze/events")

What Bronze must preserve:

  • Every record that arrived, including malformed ones
  • The original field values before any transformation
  • Ingestion metadata (_ingested_at, _source_file) for audit and replay
  • Schema evolution history — new columns from upstream should land in Bronze, not be dropped

What Bronze must NOT do:

  • Filter out records based on business rules
  • Overwrite existing data (append-only is the contract)
  • Apply business logic transformations
  • Deduplicate (duplicates at Bronze are a fact about what arrived — Silver handles deduplication)

The _rescued_data column:

When Auto Loader encounters fields that don’t match the stored schema, it puts them in _rescued_data as JSON. Bronze should preserve this column — it contains data that didn't fit the schema but arrived. Dropping _rescued_data means losing fields that failed schema mapping during ingestion.

# Monitor rescued data volume as a Bronze health signal
rescued_count = spark.sql("""
SELECT
DATE(event_ts) as event_date,
COUNT(*) as total_records,
COUNT(CASE WHEN _rescued_data IS NOT NULL THEN 1 END) as rescued_records,
ROUND(COUNT(CASE WHEN _rescued_data IS NOT NULL THEN 1 END) * 100.0
/ COUNT(*), 2) as rescued_pct
FROM prod.bronze.events
GROUP BY DATE(event_ts)
ORDER BY event_date DESC
"""
)

Rising rescued_pct is a schema drift signal. Bronze is receiving fields that don't match the expected schema. Investigate the source before the drift reaches Silver.


How Data Quality Propagation Actually Works

This is the mechanism worth understanding explicitly — because once you see how quality failures propagate, the case for layer-boundary enforcement becomes undeniable.

Trace a duplicate record through the three layers without quality checks:

Source event: event_id = "E001", user_id = "U123", revenue = 99.99

── Bronze ingestion ──────────────────────────────────────────────
Auto Loader checkpoint corruption → pipeline restart
Files from 2024-01-10 to 2024-01-12 re-processed
Bronze table receives:
Row 1: E001, U123, 99.99, _ingested_at = 2024-01-10 09:00:00
Row 2: E001, U123, 99.99, _ingested_at = 2024-01-22 14:30:00 ← duplicate

Bronze contract: append everything. Both rows land. Correct behavior.
Bronze quality signal: row count increased by 3 days of events.
If nobody checks row count trends → duplicate is invisible.

── Silver transformation ─────────────────────────────────────────
Silver reads Bronze, joins user dimension, standardizes types.
No deduplication on event_id.

Silver receives: 2 rows for E001
Silver writes: 2 rows for E001

Silver contract violated: cleaned data should be deduplicated.
Nobody enforced it. Both rows pass through.

── Gold aggregation ──────────────────────────────────────────────
Gold aggregates revenue by day:
SELECT event_date, SUM(revenue) FROM silver.events GROUP BY event_date

2024-01-10 revenue: $99.99 × 2 = $199.98 ← wrong
Actual revenue: $99.99 ← correct

Gold reports 2× revenue for three days.
Finance dashboard shows inflated numbers for eleven days.
No errors. No alerts. Wrong data, served with confidence.

The lesson: each layer that doesn’t enforce its contract becomes a pass-through for upstream failures. Quality checks at Bronze don’t prevent duplicates from arriving — but they detect them early. Quality checks at Silver deduplicate before aggregation. Quality checks at Gold validate that output metrics are in expected ranges.

Defense in depth at every layer boundary.


Silver: Correctness Enforcement

Silver’s job is to produce a dataset that consumers can trust. This requires explicit quality enforcement — not just transformation.

Data Cleaning Pattern

from pyspark.sql.functions import (
col, coalesce, lit, to_timestamp, trim, lower,
when, regexp_replace, row_number, desc
)
from pyspark.sql.window import Window

# Read Bronze
df_bronze = spark.read.format("delta") \
.load("s3://bucket/delta/bronze/events")

# Step 1: Type casting and standardization
df_typed = df_bronze \
.withColumn(
"event_ts",
to_timestamp(col("event_ts_str"), "yyyy-MM-dd'T'HH:mm:ss")
) \
.withColumn("user_id", trim(lower(col("user_id")))) \
.withColumn("revenue",
when(col("revenue_str").rlike("^[0-9.]+$"),
col("revenue_str").cast("decimal(18,2)"))
.otherwise(lit(None))
)

# Step 2: Null handling
df_nulls_handled = df_typed \
.filter(col("event_id").isNotNull()) \
.filter(col("event_ts").isNotNull()) \
.withColumn("region", coalesce(col("region"), lit("UNKNOWN")))

# Step 3: Deduplication — keep latest record per event_id
window = Window.partitionBy("event_id").orderBy(desc("_ingested_at"))

df_deduped = df_nulls_handled \
.withColumn("rn", row_number().over(window)) \
.filter(col("rn") == 1) \
.drop("rn", "_rescued_data", "event_ts_str", "revenue_str")

# Step 4: Write Silver
df_deduped.write \
.format("delta") \
.mode("overwrite") \
.partitionBy("event_date") \
.saveAsTable("prod.silver.events")
Production Silver pipelines often use MERGE or partition-scoped overwrites rather than full-table overwrite.

Data Quality Rules and Validation

Cleaning transforms data. Validation checks whether the transformed data meets quality thresholds before it’s written to Silver.

# Data quality validation before Silver write
def validate_silver(df, layer_name):
total_rows = df.count()
issues = []

# Rule 1: No null event IDs
null_event_ids = df.filter(col("event_id").isNull()).count()
if null_event_ids > 0:
issues.append(f"NULL event_ids: {null_event_ids}")

# Rule 2: Revenue must be positive when present
negative_revenue = df.filter(
col("revenue").isNotNull() & (col("revenue") <= 0)
).count()
if negative_revenue > 0:
issues.append(f"Non-positive revenue: {negative_revenue} rows")

# Rule 3: Row count within expected range
# (compare against previous day's count)
expected_min = 50_000
expected_max = 5_000_000
if total_rows < expected_min or total_rows > expected_max:
issues.append(
f"Row count {total_rows} outside expected range "
f"[{expected_min}, {expected_max}]"
)

# Rule 4: Duplicate check
duplicate_count = total_rows - df.dropDuplicates(["event_id"]).count()
if duplicate_count > 0:
issues.append(f"Duplicate event_ids: {duplicate_count}")

if issues:
raise ValueError(f"{layer_name} quality validation failed:\n" +
"\n".join(issues))

return df

# Apply validation — raises exception if quality rules fail
# Job fails loudly rather than writing bad Silver data silently
df_validated = validate_silver(df_deduped, "prod.silver.events")
df_validated.write.format("delta").mode("overwrite") \
.saveAsTable("prod.silver.events")

The operational decision: should quality failures block the write or quarantine the bad records?

Block (fail loudly): the validation function above raises an exception. The Silver table is not updated. Downstream Gold pipelines get yesterday’s data — stale but not wrong. An alert fires. An engineer investigates.

Quarantine (write what’s good, isolate what’s bad):

# Quarantine pattern — split valid and invalid records
df_valid = df_deduped.filter(
col("event_id").isNotNull() &
col("event_ts").isNotNull() &
(col("revenue").isNull() | (col("revenue") > 0))
)

df_quarantine = df_deduped.subtract(df_valid) \
.withColumn("_quarantine_reason",
when(col("event_id").isNull(), "null_event_id")
.when(col("event_ts").isNull(), "null_timestamp")
.when(col("revenue") <= 0, "invalid_revenue")
.otherwise("unknown")
)

# Write valid records to Silver
df_valid.write.format("delta").mode("overwrite") \
.saveAsTable("prod.silver.events")

# Write invalid records to quarantine table for investigation
df_quarantine.write.format("delta").mode("append") \
.saveAsTable("prod.silver.events_quarantine")

Which to use: fail loudly when the bad record volume is unexpected and indicates an upstream problem. Quarantine when bad records are expected at a low rate and you want the pipeline to continue with valid data while flagging the exceptions.

The exam tests this distinction — a scenario asking how to “apply data quality checks and validation rules to ensure reliable Silver and Gold datasets” has both patterns as valid answers depending on the stated requirement.


Gold Layer Objects: Views, Tables, Materialized Views, and Streaming Tables

The Gold layer serves consumers — BI dashboards, ML feature stores, operational APIs, finance reports. Different consumers have different requirements, and the right Gold layer object type depends on those requirements.

Regular Views

A view is a saved query — no data stored. Every query against the view re-executes the underlying SQL against Silver tables.

-- Gold view — no storage, always reflects current Silver data
CREATE OR REPLACE VIEW prod.gold.daily_revenue AS
SELECT
DATE(event_ts) as event_date,
region,
SUM(revenue) as total_revenue,
COUNT(DISTINCT user_id) as unique_users,
COUNT(*) as transaction_count
FROM prod.silver.events
WHERE event_type = 'purchase'
GROUP BY DATE(event_ts), region;

When views are correct: small Silver tables, infrequent queries, or when real-time freshness is required and the query is fast enough to run on-demand.

When views are wrong: large Silver tables where the aggregation query takes minutes — every dashboard refresh re-runs the expensive query. This is the most common Gold layer performance mistake.

Materialized Views

A materialized view stores pre-computed query results. Databricks refreshes it automatically when the underlying Silver data changes.

-- Materialized view — results stored, auto-refreshed
CREATE OR REPLACE MATERIALIZED VIEW prod.gold.daily_revenue_mv AS
SELECT
DATE(event_ts) as event_date,
region,
SUM(revenue) as total_revenue,
COUNT(DISTINCT user_id) as unique_users,
COUNT(*) as transaction_count
FROM prod.silver.events
WHERE event_type = 'purchase'
GROUP BY DATE(event_ts), region;

The key difference from a regular view: the query runs once (or on refresh), results are stored in Delta, and subsequent reads query the stored results — not the Silver table. Dashboard queries are fast regardless of Silver table size.

Refresh semantics: materialized views in Databricks refresh when the underlying tables change (incremental refresh) or on a schedule. Full refresh re-computes everything. Incremental refresh recomputes only affected partitions.

When materialized views are correct: expensive aggregation queries that are read frequently by BI tools. The pre-computation cost is paid once; the read cost is paid many times at low cost.

When materialized views are wrong: workloads requiring real-time data where even a few minutes of refresh lag is unacceptable.

Streaming Tables

A streaming table is a Delta table populated by a continuous or triggered streaming query. It ingests new data incrementally rather than reprocessing everything.

# Streaming table — appends new aggregated data as Silver updates
from pyspark.sql.functions import window, sum as spark_sum, countDistinct

df_silver_stream = spark.readStream \
.format("delta") \
.load("s3://bucket/delta/silver/events")

df_gold_stream = df_silver_stream \
.filter(col("event_type") == "purchase") \
.groupBy(
window(col("event_ts"), "1 hour"),
col("region")
) \
.agg(
spark_sum("revenue").alias("hourly_revenue"),
countDistinct("user_id").alias("unique_users")
)

df_gold_stream.writeStream \
.format("delta") \
.outputMode("complete") \
.option("checkpointLocation", "s3://bucket/checkpoints/gold/hourly_revenue") \
.trigger(processingTime="5 minutes") \
.start("s3://bucket/delta/gold/hourly_revenue")

When streaming tables are correct: near-real-time Gold layer metrics where latency under 5–10 minutes matters. Operational dashboards, live monitoring, alerting systems.

When streaming tables are wrong: complex aggregations that require full historical context (streaming aggregations work on windows, not all-time history), or when the Silver layer itself is a batch pipeline that writes infrequently.

Regular Delta Tables (Batch Gold)

The most straightforward Gold object — a Delta table written by a scheduled batch job that reads Silver and writes aggregated results.

-- Batch Gold table — scheduled daily write
CREATE OR REPLACE TABLE prod.gold.monthly_revenue
USING DELTA
PARTITIONED BY (event_month)
AS
SELECT
DATE_TRUNC('month', event_ts) as event_month,
region,
product_category,
SUM(revenue) as total_revenue,
COUNT(DISTINCT user_id) as unique_customers
FROM prod.silver.events
WHERE event_type = 'purchase'
GROUP BY
DATE_TRUNC('month', event_ts),
region,
product_category;

When batch Gold tables are correct: daily or weekly reporting, finance reconciliation, ML training datasets where latency of hours is acceptable.

The Gold Object Decision Matrix

Requirement                          Object Type
──────────────────────────────────────────────────────────────
Always-fresh data, fast query Regular View
(Silver is small)
Always-fresh data, fast query Materialized View
(Silver is large, expensive query)
Near-real-time (< 10 min latency) Streaming Table
Batch reporting (hourly/daily) Delta Table (batch write)
ML feature store (point-in-time) Delta Table with time travel

Data Quality for Gold: Output Validation

Silver quality checks validate inputs. Gold quality checks validate outputs — confirming that aggregated results are within expected ranges before serving them to consumers.

# Gold output validation
def validate_gold_revenue(df):
issues = []

# Revenue should never be negative
negative_revenue_regions = df.filter(col("total_revenue") < 0) \
.select("region").collect()
if negative_revenue_regions:
issues.append(f"Negative revenue in regions: {negative_revenue_regions}")

# Day-over-day revenue change should be within 50%
# (catches aggregation explosions from duplicate Bronze data)
today = df.filter(col("event_date") == "2024-01-22") \
.agg({"total_revenue": "sum"}).collect()[0][0]
yesterday = df.filter(col("event_date") == "2024-01-21") \
.agg({"total_revenue": "sum"}).collect()[0][0]

if yesterday and today:
change_pct = abs(today - yesterday) / yesterday * 100
if change_pct > 50:
issues.append(
f"Revenue change {change_pct:.1f}% exceeds 50% threshold. "
f"Today: {today}, Yesterday: {yesterday}"
)

if issues:
raise ValueError("Gold validation failed:\n" + "\n".join(issues))

The day-over-day change check is specifically designed to catch the Bronze duplicate propagation scenario from the opening hook. An 11-day duplicate would have caused a 100%+ revenue spike on the first affected day — caught immediately by this check instead of running for eleven days.


Architecture Flow: Three Layers, Three Contracts

Source Systems (APIs, Files, Databases)
│
▼ [Auto Loader / Lakeflow Connect / COPY INTO]
┌─────────────────────────────────────────────────────────────┐
│ BRONZE LAYER │
│ Contract: Completeness │
│ ├── Append-only Delta tables │
│ ├── Raw data, minimal transformation │
│ ├── Schema evolution (addNewColumns) │
│ ├── _ingested_at, _source_file metadata │
│ ├── _rescued_data preserved │
│ └── Quality signal: row count trends, rescued_pct │
└──────────────────────────┬──────────────────────────────────┘
│ [Spark batch or streaming]
▼
┌─────────────────────────────────────────────────────────────┐
│ SILVER LAYER │
│ Contract: Correctness │
│ ├── Type casting, null handling, string normalization │
│ ├── Deduplication (window function on business key) │
│ ├── Explicit quality validation (fail or quarantine) │
│ ├── Conformed schema (stable column names, types) │
│ └── Quality signal: quarantine table row count │
└──────────────────────────┬──────────────────────────────────┘
│ [Spark batch, streaming, or SQL]
▼
┌─────────────────────────────────────────────────────────────┐
│ GOLD LAYER │
│ Contract: Fitness for purpose │
│ ├── Views (small Silver, real-time freshness needed) │
│ ├── Materialized Views (large Silver, BI query performance)│
│ ├── Streaming Tables (near-real-time metrics) │
│ ├── Delta Tables (batch reporting, ML training) │
│ └── Quality signal: output range validation │
└──────────────────────────┬──────────────────────────────────┘
│
┌────────────┴────────────┐
▼ ▼
BI / Dashboards ML Pipelines
(SQL Warehouse) (Spark reads)

Failure Modes You’ll See in Production

Bronze overwrite destroying replay capability. A pipeline developer uses .mode("overwrite") on the Bronze write because they want a clean table. Bronze loses its history. If Silver produces wrong data next week, there's nothing to replay from. Enforce append-only at Bronze through cluster policies or pipeline code review.

Silver deduplication on wrong key. dropDuplicates(["user_id"]) instead of dropDuplicates(["event_id"]). One record per user instead of one record per event. Legitimate duplicate users are collapsed. Revenue counts are wrong — not inflated, but deflated. No error, just wrong numbers.

Gold view query timeout on large Silver. A BI team creates a Gold view over a 2TB Silver table. Every dashboard refresh re-runs a full aggregation over 2TB. Query timeout. Dashboard shows no data instead of cached results. The fix — materialized view — was available from the start. The view worked fine when Silver was 50GB. It failed silently (timeouts, not errors) when Silver grew.

Materialized view refresh lag causing stale Gold. A materialized view refreshes every 4 hours. A Silver pipeline writes new data every 30 minutes. BI users see data that’s up to 4 hours old — without knowing it. They assume Gold is fresh because the dashboard shows data. Freshness metadata should be exposed alongside the data.

Streaming table with complete output mode reprocessing all data. A streaming aggregation with outputMode("complete")rewrites the entire Gold table on every trigger — not just new data. For a Gold table with 2 years of hourly data, every 5-minute trigger rewrites 17,520 rows. This is correct behavior for complete mode — but at scale it generates thousands of small Delta files and degrades read performance rapidly without OPTIMIZE.

Quality check that validates the wrong thing. A Silver quality check validates that row count is above 50,000. The pipeline has a bug that drops 80% of records. 50,000 rows pass the threshold. The check passes. Wrong data is written to Silver. The threshold was chosen arbitrarily, not based on expected volume. Quality checks need calibrated thresholds, not arbitrary ones.


Trade-offs: What Each Layer Optimizes For

Bronze: Optimized for completeness and replayability. Sacrifices storage efficiency (all data retained, including malformed records) and query performance (raw, unoptimized schema). Bronze tables are not meant to be queried by end users — they’re meant to be readable by Silver pipelines.

Silver: Optimized for correctness and schema stability. Sacrifices completeness (bad records may be quarantined or dropped) and raw fidelity (types are cast, strings are normalized). Silver is the contract surface — changing Silver schema breaks downstream consumers.

Gold: Optimized for consumer query patterns. Sacrifices generality — a Gold table built for finance reporting may be useless for ML training. Multiple Gold tables for different consumers is correct architecture, not redundancy.


Real-World Constraints

Schema evolution at Silver is expensive. Adding a column to Silver requires either reprocessing all Bronze data (full refresh) or accepting that historical Silver records have NULL for the new column. Both have costs. Silver schema changes should be infrequent and deliberate — which is why Bronze’s schema-flexible approach (addNewColumns, _rescued_data) matters. Bronze absorbs schema changes; Silver stabilizes them.

Gold for AI and BI simultaneously. The exam explicitly tests “Gold layer objects for BI and analytics teams” — but production Gold layers often serve both BI dashboards and ML training pipelines. These have conflicting requirements: BI wants fast aggregations, ML wants raw denormalized records with full history. A single Gold table optimized for BI (aggregated, partitioned by date) is wrong for ML (needs row-level detail, point-in-time correctness).

The correct architecture: separate Gold objects for each consumer pattern. A gold.daily_metrics materialized view for BI. A gold.training_features Delta table with time travel for ML. Not one Gold table that tries to serve both.

OPTIMIZE and ZORDER on Silver and Gold. High-frequency Silver writes (streaming pipelines writing every few minutes) generate many small Delta files. Without OPTIMIZE, Silver read performance degrades over weeks. Schedule OPTIMIZE runs as part of the pipeline maintenance — not as a reaction to slow queries.

-- Maintenance pattern for Silver tables
OPTIMIZE prod.silver.events ZORDER BY (user_id, event_date);
VACUUM prod.silver.events RETAIN 168 HOURS;
ANALYZE TABLE prod.silver.events COMPUTE STATISTICS FOR ALL COLUMNS;

What Databricks Expects You to Reason About

Medallion architecture questions on the exam test layer responsibility and Gold object selection — not just the three-layer naming.

Each layer has a specific contract. Bronze = completeness, append-only, replayable. Silver = correctness, deduplicated, validated. Gold = fitness for purpose, consumer-optimized. A scenario asking where deduplication belongs has Silver as the answer — not Bronze (which preserves duplicates as a record of what arrived) and not Gold (which aggregates deduplicated data).

Gold object type selection is driven by requirements. A scenario describing a BI dashboard that needs fast query performance over a large Silver table has materialized view as the answer — not a regular view (which re-runs the expensive query on every dashboard refresh) and not a streaming table (which adds unnecessary streaming complexity for a batch BI use case).

Materialized view vs streaming table vs regular table. Materialized view = auto-refreshed pre-computed results for query performance. Streaming table = continuous or triggered ingestion of new data from a stream. Regular table = batch write from a scheduled job. The exam will describe a latency requirement and ask which Gold object is correct. Match the latency requirement to the object type.

Data quality checks belong at every layer boundary. A scenario describing unexpected data quality issues in Gold that are traced to Bronze has the missing Silver validation layer as the root cause. Quality checks at Bronze detect anomalies early. Quality checks at Silver prevent bad data from reaching Gold. Quality checks at Gold catch anything that slipped through.

The BI and AI access pattern. Unity Catalog with Delta as a single source of truth provides consistent access for both BI (via SQL Warehouse on Gold views/materialized views) and AI/ML (via Spark reads on Gold Delta tables). The exam tests whether you can identify the correct architecture for a scenario requiring both types of access simultaneously.


Summary: The Engineering Lesson

The Medallion architecture’s value isn’t the three-layer structure. Any data platform has staging, processing, and serving layers. The value is the explicit quality contracts at each layer boundary — and the operational discipline to enforce them.

Bronze without append-only enforcement becomes a mutable staging area. Silver without deduplication and validation becomes an expensive copy of Bronze. Gold without output validation becomes a confidence facade on top of unchecked data.

The eleven-day revenue error from the opening hook wasn’t a Medallion architecture failure. It was a contract enforcement failure at Bronze (no duplicate detection) and Silver (no deduplication). The architecture existed. The enforcement didn’t.

Architecture is the structure. Contracts are the guarantees. Enforcement is the engineering.

All three are required. Having two out of three is how you end up with wrong revenue numbers for eleven days with no errors and no alerts.


🔥 Next in Series

Part 8 — Spark Tuning: Partitions, Memory, and Liquid Clustering

Transformation correctness is Part 6 and Part 7. Transformation performance is Part 8.

We’ll go deep on the tuning parameters the exam tests directly — spark.sql.shuffle.partitions, spark.default.parallelism, executor and driver memory configuration, and the broadcast threshold. Then we'll cover Liquid Clustering — Databricks' replacement for traditional partitioning that eliminates the rigid partition structure problem that causes small-file proliferation and query plan degradation at scale. Understanding when Liquid Clustering is better than Z-order is an exam question — and a production architectural decision.


🔔 Follow for More

Follow TheDataForge for high-signal deep dives on Spark, Kafka, Streaming, Lakehouse, and real-world data engineering — no fluff, only engineering truth.

⚡️Let’s connect — I post daily Big Data & Spark insights at DataForgeX on X.

💬 Comment Below

What’s the most damaging data quality failure you’ve seen propagate silently through a multi-layer pipeline?

Was it duplicates from a checkpoint restart at Bronze that inflated revenue metrics for days? A Silver quality check with an arbitrary threshold that passed when 80% of records were dropped? A Gold materialized view that served stale data for hours because the refresh schedule was misconfigured and nobody added freshness metadata to the dashboard?

And — how long did it take to trace the bad Gold output back to the Bronze root cause?


Tags

#medallion-architecture #bronze-silver-gold #data-quality #materialized-views #streaming-tables #pyspark #delta-lake #unity-catalog #databricks-certification #dataforge