Part F · Chapter 26 · The platform on Azure, streaming and AI

26. The medallion architecture 1: the layers

The medallion architecture keeps a lakehouse's data in three layers: bronze holds what arrived, silver makes it clean and shared, gold answers the business's questions. Each layer makes one promise to the people who read it.

Records flowing from bronze to silver to gold
Playback speed

The clip sends the broker portal's daily claims file through three layers. In bronze, all ten lines land exactly as received. In silver, a line whose date does not parse and one whose amount does not parse are set aside, a claim sent twice is kept once, Kestrel's loss-cause codes join the combined list, pounds and zloty become euros and medical notes are masked: seven claims. In gold, the claims are summed per quarter and line for the board. Then each layer's promise, and the Delta Lake transaction log under every table.

The idea: three layers, three promises

A lake that only stores files becomes a swamp: nobody knows which file is right, half-written loads are read, and nothing says what a column means. The medallion architecture answers with three layers, each with one promise:

  • Bronze: the data as it arrived, every file and every message, with where and when it came from. Nothing is fixed here, so any later layer can be rebuilt from it.
  • Silver: the data clean and shared: real types, one row per thing (claim, customer, policy), duplicates gone, codes on the shared lists. Silver is where most of the work happens, and where most teams should read.
  • Gold: the data shaped to answer questions: the board's measures, a star schema for reports, a data product for another domain.

What made this possible on cheap storage is the open table format (Delta Lake, Apache Iceberg, Apache Hudi): a transaction log beside the files that makes every change a commit, enforces the schema, and keeps every version readable.

Promise, not location A layer is defined by what it promises its readers, not by a folder name. A table called silver that still holds unparsed text breaks the promise, whatever its name.
Remember Bronze keeps what arrived, silver makes it clean and shared, gold answers the question: place every step where its result keeps the layer's promise.

A worked example: the broker portal's daily file

The broker portal sends 10 lines. Bronze keeps all 10. Silver rejects 2 (a date and an amount that do not parse), drops 1 duplicate, conforms Kestrel's codes, converts to euros and masks the medical notes: 7 claims. Gold sums them into 5 rows, one per quarter and line.

Gold: incurred claims per quarter and line (computed by the engine; the same rows come back from Spark with Delta Lake in CI)
QuarterLineClaimsIncurred
2026-Q3home1€1,200
2026-Q3travel1€936
2026-Q4home2€7,100
2026-Q4motor1€2,400
2026-Q4travel2€1,140
The three layers as Spark SQL on Delta Lake (run on Spark 4.0.1 with Delta Lake 4.0.1 in CI)
CREATE SCHEMA bronze;

CREATE SCHEMA silver;

CREATE SCHEMA gold;

CREATE TABLE bronze.broker_claims (
  claim_ref STRING, line STRING, loss_date STRING, cause_code STRING, amount STRING,
  currency STRING, medical_note STRING, file_name STRING, loaded_at TIMESTAMP
) USING DELTA;

INSERT INTO bronze.broker_claims VALUES
  ('BP-1001', 'home', '2026-09-28', 'WTR', '1200.00', 'EUR', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1002', 'motor', '2026-10-01', 'collision', '2400.50', 'EUR', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1002', 'motor', '2026-10-01', 'collision', '2400.50', 'EUR', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1003', 'home', '2026-13-01', 'storm', '900.00', 'EUR', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1004', 'travel', '2026-09-20', 'medical', '800.00', 'GBP', 'Fractured wrist, treated in Leeds', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1005', 'travel', '2026-10-03', 'theft', '3000.00', 'PLN', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1006', 'motor', '2026-10-02', 'collision', '1,2O0', 'EUR', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1007', 'home', '2026-10-04', 'BRD', '5600.00', 'EUR', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1008', 'home', '2026-10-05', 'STM', '1500.00', 'EUR', '', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00'),
  ('BP-1009', 'travel', '2026-10-06', 'medical', '450.00', 'EUR', 'Food poisoning, two nights in hospital', 'broker-portal-claims-2026-10-06.csv', TIMESTAMP '2026-10-07 02:00:00');

CREATE TABLE silver.claims USING DELTA AS
WITH typed AS (
  SELECT claim_ref, line, TRY_CAST(loss_date AS DATE) AS loss_date, cause_code,
         TRY_CAST(amount AS DECIMAL(12,2)) AS amount, currency, medical_note
  FROM bronze.broker_claims
),
deduplicated AS (
  SELECT DISTINCT * FROM typed WHERE loss_date IS NOT NULL AND amount IS NOT NULL
)
SELECT d.claim_ref, d.line, d.loss_date, COALESCE(m.managed_code, d.cause_code) AS cause,
       CAST(d.amount * r.rate_to_eur AS DECIMAL(12,2)) AS amount_eur, d.currency AS original_currency,
       CASE WHEN d.medical_note = '' THEN NULL ELSE 'masked' END AS medical_note
FROM deduplicated d
LEFT JOIN (VALUES ('WTR', 'water'), ('BRD', 'fire'), ('STM', 'storm')) AS m(source_code, managed_code) ON m.source_code = d.cause_code
JOIN (VALUES ('EUR', 1.00), ('GBP', 1.17), ('PLN', 0.23)) AS r(currency, rate_to_eur) ON r.currency = d.currency;

CREATE TABLE gold.incurred_by_quarter USING DELTA AS
SELECT CONCAT(CAST(YEAR(loss_date) AS STRING), '-Q', CAST(QUARTER(loss_date) AS STRING)) AS quarter,
       line, COUNT(*) AS claims, SUM(amount_eur) AS incurred_eur
FROM silver.claims
GROUP BY 1, 2;

SELECT quarter, line, claims, incurred_eur FROM gold.incurred_by_quarter ORDER BY quarter, line;
Try this In the Quality workbench, look at the gates between silver and gold: a rule can quarantine a record at the silver gate or stop the load before gold.

Why it matters for Alex

The merger doubles every feed. Without layers, each report cleans the raw files its own way and the board gets two loss ratios again. With them, cleaning happens once in silver, every report reads the same claims, and when a parsing bug is found the fix is a rerun from bronze, not a request to the broker for last month's files.

Where it goes wrong

  • Fixing data in bronze. Once bronze is changed, nothing can be replayed from it.
  • Gold for everything. Every team builds its own gold from bronze, and silver's shared cleaning is skipped: the same bugs, fixed differently, in ten places.
  • Silver summed up. Aggregating in silver throws away the records every other use needs.
  • Layers as folders. Three folders of plain files are still a swamp: without a table format, readers see half-written loads and no schema.

Exercises

The lab checks each one against facts written down in advance, so any answer the brief allows passes. A pass is kept in this browser.

Place each step in a layer

Analysts and the board read gold only. For each step on the broker portal's file, choose a layer where it keeps every layer's promise.

Land the broker portal's daily claims file as received, with the load time and file name
Parse dates and amounts into proper types; reject rows that do not parse
Remove claims the portal sent twice
Map Kestrel's loss-cause codes to the combined code list
Convert travel claims paid in pounds and zloty to euros
Mask the claimant's medical details
Keep each customer's address history (slowly changing, type 2)
Sum incurred claims per quarter and line for the loss ratio

Which layer promises it?

Each line is a promise one layer makes to the people who read it. Choose the layer.

Holds the file exactly as it arrived, with its file name and load time
Lets you rebuild every other layer after a bug is fixed
One row per claim, with real dates and amounts
Loss causes from both companies on the combined code list
Incurred claims per quarter and line, ready for the board pack
A table shaped for one question, which may leave detail out

Who reads which layer?

Choose the layer each reader should read.

An engineer replaying last month's files after fixing a parsing bug
The steward counting the lines that failed to parse
The fraud data scientists, training a model on every claim
Match and merge, building golden customers from both companies
The board pack's loss ratio
The claims director's nightly dashboard

On Azure

Checked against Microsoft's documentation on 18 October 2026.

On Azure the layers are Delta tables in a lake, organised for the platform you choose:

  • Microsoft Fabric: OneLake under a lakehouse per layer (or schemas in one lakehouse); Data Factory pipelines or Eventstream land bronze, and Spark notebooks or Dataflows Gen2 build silver and gold. Every Fabric table is stored as Delta.
  • Azure Databricks: ADLS Gen2 storage under Unity Catalog, often with a catalog or schema per layer; Auto Loader lands files into bronze, and Lakeflow Spark Declarative Pipelines build silver and gold with expectations as quality checks.
  • Both store Delta Lake, so a table written by one can be read by the other: OneLake shortcuts point at ADLS Gen2, and Fabric can mirror a Unity Catalog.

Give each layer its own access: few people need bronze, many read silver, most read gold.

Take it to work

Medallion layer design

Write down what each layer promises, and where each step of a feed goes.

Bronze

  • What lands, and the metadata kept with it (source, file, load time)
  • How long is it kept, and who may read it?

Silver

  • The grain of each table
  • Typing, de-duplication and the shared code lists applied

Gold

  • The questions it answers, and for whom

Judgement steps

  • Masking, currency, history: silver or gold, and why

Table format and access

  • Delta Lake or another open format
  • Who reads each layer

Tools in this chapter

  • Quality workbench · Write quality rules, set thresholds, inject defects, and see the scores per dimension and per domain.

Terms taught here: Medallion architectureDelta Lake

An unhandled error has occurred. Reload 🗙

Reconnecting…

Your connection to the Cloud Data Architecture Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.