What is medallion architecture?
Medallion architecture is a way to organize a lakehouse into three layers of tables: bronze holds raw data as it arrived, silver holds cleaned and typed data, and gold holds business-level tables built for reports. Each layer is built from the one before it, so downstream data can always be rebuilt from the raw copy.
Bronze, silver and gold
The names come from Databricks, but the idea is older: keep raw data, clean it once, and build reporting tables on top. Each layer is a set of ordinary tables, usually Parquet files or Apache Iceberg tables in object storage, and each step is a SQL transformation, often a dbt model.
| Layer | Holds | Typical work | Who reads it |
|---|---|---|---|
| Bronze | Raw data as delivered, plus load metadata | Append only, no cleaning | Pipelines, and people debugging them |
| Silver | Typed, deduplicated, validated rows | Casts, dedup, dropping bad rows, joins to reference data | Analysts and data scientists |
| Gold | Aggregates and business entities | GROUP BY, metrics, one table per report or domain | Dashboards, BI tools, AI agents |
The three steps in SQL
This runs in DuckDB. A CSV export arrives with every value as text, one duplicate order and one amount that isn't a number. Bronze keeps all five rows, silver keeps the three valid ones, and gold sums them by day.
-- Bronze: land the file as-is, every column as text, plus load metadata
CREATE TABLE bronze_orders AS
SELECT *, filename AS _source_file, now() AS _loaded_at
FROM read_csv('orders_export.csv', all_varchar = true, filename = true);
-- Silver: typed, deduplicated, invalid rows filtered out
CREATE TABLE silver_orders AS
SELECT order_id::INT AS order_id,
customer_id,
TRY_CAST(amount AS DECIMAL(10,2)) AS amount,
created_at::TIMESTAMP AS created_at
FROM bronze_orders
WHERE TRY_CAST(amount AS DECIMAL(10,2)) IS NOT NULL
QUALIFY row_number() OVER (PARTITION BY order_id ORDER BY _loaded_at DESC) = 1;
-- Gold: one row per day, the shape a dashboard reads
CREATE TABLE gold_daily_revenue AS
SELECT created_at::DATE AS day, count(*) AS orders, sum(amount) AS revenue
FROM silver_orders
GROUP BY 1
ORDER BY 1;Bronze has 5 rows, silver 3, and gold two days: 2 orders for 62.40 on 2026-11-20 and 1 order for 230.00 on 2026-11-21. QUALIFY keeps the latest copy of each order. In dbt, each statement becomes a model file, and the silver model selects from bronze with ref() instead of a table name, which also gives dbt the lineage between them.
{{ config(materialized='table') }}
SELECT order_id::INT AS order_id, customer_id,
TRY_CAST(amount AS DECIMAL(10,2)) AS amount,
created_at::TIMESTAMP AS created_at
FROM {{ ref('bronze_orders') }}
WHERE TRY_CAST(amount AS DECIMAL(10,2)) IS NOT NULL
QUALIFY row_number() OVER (PARTITION BY order_id ORDER BY _loaded_at DESC) = 1Trade-offs
- Storage. Three layers can mean three copies of the same rows. Bronze is often the largest layer and the least read.
- Latency. Data reaches gold only after every step has run, so the slowest step sets the data freshness of the reports.
- Ceremony. For a small source that is already clean, such as a well-designed Postgres table, a bronze copy adds a load step and little else. Reading the source in place and building silver or gold from it is a reasonable shortcut.
- Reprocessing. The main benefit: when a cleaning rule changes, you rebuild silver and gold from bronze instead of asking the source to resend history.
The layers are a naming convention, not a feature of any engine. dbt projects often use staging, intermediate and marts for the same idea. What matters is that each layer has one job and raw data is never overwritten.
In Thunderduck
In Thunderduck, the layers are usually dbt models in your own Git repository, materialized into an Iceberg catalog. A pipeline defined in thunderduck.yml runs them on a cron schedule, step by step, for example a seed followed by a dbt build of staging+. Bronze does not always have to be a copy: a model can read a PostgreSQL, MySQL or BigQuery catalog, or files in S3, GCS, Azure or R2, where they live, with filters pushed down to the source.
Freshness rules per model open a Slack alert when a table falls behind, and a branch run writes only to dev catalogs, so a change to a silver model can be tested against production data before it is merged.
Docs: https://docs.thunderduck.ai/data/pipelines/