
Medallion architecture
Medallion architecture: from raw files to trusted tables, one layer at a time.
The medallion architecture is a framework to adapt, not a template to copy. On Ilum its three layers are built with Spark, Airflow and dbt on Iceberg or Delta tables.
What is the medallion architecture?
A way to organize a data lakehouse in three layers, each rebuilt from the one below. Quality improves step by step and nothing is lost.
- JSON
- CSV
- XML
- Parquet
- Kafka
- SQL
- logs
- Data science and ML
- BI and reporting
- Streaming analytics
Bronze: Raw and immutable
Data lands as it arrived, in JSON, CSV or Parquet, appended and partitioned by ingestion date with the source system recorded. Schema-on-read. Nothing is changed, so the full history is kept.
- Holds
- Raw history, exactly as received
- Stored as
- Append-only Iceberg or Delta tables over JSON, CSV or Parquet files, partitioned by ingestion date
- Read by
- Data engineers, for replay and audit
- Tuned for
- Writes. Keep it append-only, partition by ingestion date, and let Spark write files large enough that the next layer reads them efficiently.
Silver: Cleaned and validated
Deduplication, type casting, null handling and business rules turn Bronze into one trusted record per entity. The schema is enforced and evolves with compatibility checks. MERGE keeps the tables current and auditable.
- Holds
- One validated record per entity: the enterprise view
- Stored as
- Iceberg or Delta tables with an enforced schema, kept current with MERGE
- Read by
- Data scientists, analysts building Gold, feature pipelines
- Tuned for
- MERGE. Sort or cluster the table on the keys you match on, use adaptive query execution and broadcast joins for small dimensions, and compact files after upserts.
Gold: Shaped for consumption
Aggregates, star schemas and domain data marts built for one use: a dashboard, a regulatory report, a feature table for a model. Optimized for the queries that will run on it.
- Holds
- Business-ready tables for a defined use: the project view
- Stored as
- Star schemas, aggregates and materialized views in columnar tables
- Read by
- BI tools over Trino or JDBC, business users, model training and inference
- Tuned for
- Reads. Pre-aggregate, build materialized views for the queries dashboards actually run, use data skipping and bloom filters on filter columns, and serve through Trino so BI tools do not start a Spark job per query.
Follow one payment.
One card payment of a bank, as each layer holds it. Move it from bronze to gold and point at a field to see where its value came from.
As it arrivedthe raw row, 11 fieldsCarried overfrom the raw row, as it was
Where txn_id came from
- T00000011499txn_idas the feed delivered it
As it arrived
The id the card feed gave this payment. Silver uses it to keep each payment once.
Where txn_id came from
- T00000011499txn_idthe raw row, unchanged
In card-transactions-daily
.dropDuplicates(["txn_id"])
Carried over
Kept as it was. Silver keeps one row for each txn_id, so a payment the feed sent twice is stored once.
Where card_id came from
- K000029138card_idas the feed delivered it
As it arrived
An id. Nothing in this row says which card it is or who owns it. Silver finds out in bank_bronze.cards and the two tables after it.
Where card_id came from
- K000029138card_idthe raw row, unchanged
In card-transactions-daily
F.col("card_id").isNotNull() .join(cards, "card_id")Carried over
Kept, and followed. It found a MASTERCARD debit card in bank_bronze.cards and, through its account, the customer. A row without a card_id is dropped before the joins.
Where merchant_id came from
- M0042145merchant_idas the feed delivered it
As it arrived
An id. Nothing in this row says where the money was spent. The answer is in bank_bronze.merchants.
Where merchant_id came from
- M0042145merchant_idthe raw row, unchanged
In card-transactions-daily
F.col("merchant_id").isNotNull() .join(F.broadcast(merchants), "merchant_id", "left")Carried over
Kept, and followed. It found Green Valley Market, a grocery merchant in ES. A row without a merchant_id is dropped before the joins.
Where txn_ts came from
- 2026-11-18T18:10:35Ztxn_tsas the feed delivered it
As it arrived
The moment of the payment, in UTC.
Where txn_ts came from
- 2026-11-18T18:10:35Ztxn_tsthe raw row, unchanged
In card-transactions-daily
F.hour("txn_ts") < 5Carried over
Kept. The job reads its hour, 18, to tell a payment made at night from the rest.
Where txn_type came from
- PURCHASEtxn_typeas the feed delivered it
As it arrived
The type of the payment.
Where txn_type came from
- PURCHASEtxn_typethe raw row, unchanged
In card-transactions-daily
enriched.select(..., "txn_type", ...)
Carried over
Kept as it is. Nothing is built from it.
Where amount came from
- 124.12amountas the feed delivered it
As it arrived
The amount in the currency of the payment, here EUR. Amounts in two currencies cannot be added up yet.
Where amount came from
- 124.12amountthe raw row, unchanged
In card-transactions-daily
F.round(F.col("amount") * F.coalesce(F.col("usd_rate"), F.lit(1.0)), 2)Carried over
Kept, and converted. Beside it silver writes the same amount in dollars, amount_usd.
Where currency came from
- EURcurrencyas the feed delivered it
As it arrived
The currency of the amount.
Where currency came from
- EURcurrencythe raw row, unchanged
In card-transactions-daily
.join(F.broadcast(fx), ["txn_date", "currency"], "left")
Carried over
Kept. With the day of the payment it picks the exchange rate in bank_bronze.fx_rates.
Where channel came from
- CONTACTLESSchannelas the feed delivered it
As it arrived
How the card was used.
Where channel came from
- CONTACTLESSchannelthe raw row, unchanged
In card-transactions-daily
F.when(F.col("channel") == "ECOM", 10).otherwise(0)Carried over
Kept. The risk score adds 10 for ECOM, and this payment was CONTACTLESS. Gold groups by it.
Where status came from
- APPROVEDstatusas the feed delivered it
As it arrived
Whether the payment went through.
Where status came from
- APPROVEDstatusthe raw row, unchanged
In card-transactions-daily
F.when(F.col("status") == "DECLINED", 15).otherwise(0)Carried over
Kept. The risk score adds 15 for DECLINED. Gold counts the approved payments by it and adds up their dollars.
Where scope came from
- INTERNATIONALscopeas the feed delivered it
As it arrived
Whether the payment crossed a border.
Where scope came from
- INTERNATIONALscopebank_bronze.transactions
- →trueis_internationalkept in its place
In card-transactions-daily
F.col("scope") == "INTERNATIONAL"Read, not kept
Read and not kept. Silver holds the same fact as a flag, is_international, which the risk score reads.
Where txn_date came from
- 2026-11-18txn_dateas the feed delivered it
As it arrived
The business day of the payment. The table is partitioned by it.
Where txn_date came from
- 2026-11-18txn_datethe raw row, unchanged
In card-transactions-daily
.join(F.broadcast(fx), ["txn_date", "currency"], "left")
Carried over
Kept. Silver is partitioned by it too, and a run of the job rewrites only the days it read. With the currency it picks the rate of that day.
Not in the rowfour other tables hold theseJoinedlooked up by id in four tables
bank_bronze.cards by card_id
Where network came from
- K000029138card_idthe raw row
- →MASTERCARDnetworkbank_bronze.cards
In card-transactions-daily
.join(cards, "card_id")
Joined
The network of the card. An inner join: a payment whose card is not in that table does not reach silver.
Where card_type came from
- K000029138card_idthe raw row
- →debitcard_typebank_bronze.cards
In card-transactions-daily
.join(cards, "card_id")
Joined
The type of the card, from the same row.
Where account_id came from
- K000029138card_idthe raw row
- →A000033994account_idbank_bronze.cards
In card-transactions-daily
.join(cards, "card_id")
Joined
The account the card belongs to. Silver keeps it and follows it one table further.
bank_bronze.accounts by account_id
Where customer_id came from
- K000029138card_idthe raw row
- →A000033994account_idbank_bronze.cards
- →C00024281customer_idbank_bronze.accounts
In card-transactions-daily
.join(owners, "account_id")
Joined
The owner of the account, two lookups from the raw row. Silver keeps the id and follows it to the customer.
bank_bronze.customers by customer_id
Where customer_state came from
- K000029138card_idthe raw row
- →A000033994account_idbank_bronze.cards
- →C00024281customer_idbank_bronze.accounts
- →Californiastatebank_bronze.customers
In card-transactions-daily
.join(customers, "customer_id") F.col("state").alias("customer_state")Joined
Three lookups from the raw row: the card, its account, the owner of the account. The job renames state to customer_state, and gold groups by it.
Where segment came from
- K000029138card_idthe raw row
- →A000033994account_idbank_bronze.cards
- →C00024281customer_idbank_bronze.accounts
- →retailsegmentbank_bronze.customers
In card-transactions-daily
.join(customers, "customer_id")
Joined
From bank_bronze.customers the job takes only the segment and the state. The name and the other personal fields of the customer stay in bronze.
bank_bronze.merchants by merchant_id
Where merchant_name came from
- M0042145merchant_idthe raw row
- →Green Valley Marketnamebank_bronze.merchants
In card-transactions-daily
.join(F.broadcast(merchants), "merchant_id", "left") F.col("name").alias("merchant_name")Joined
The name behind M0042145, renamed from name. A left join: a payment whose merchant is not in the table still reaches silver, with these four fields empty.
Where category came from
- M0042145merchant_idthe raw row
- →grocerycategorybank_bronze.merchants
In card-transactions-daily
.join(F.broadcast(merchants), "merchant_id", "left")
Joined
What the merchant sells. Gold groups by it.
Where mcc came from
- M0042145merchant_idthe raw row
- →5411mccbank_bronze.merchants
In card-transactions-daily
.join(F.broadcast(merchants), "merchant_id", "left")
Joined
The merchant category code, from the same row.
Where merchant_country came from
- M0042145merchant_idthe raw row
- →EScountrybank_bronze.merchants
In card-transactions-daily
.join(F.broadcast(merchants), "merchant_id", "left") F.col("country").alias("merchant_country")Joined
The country of the merchant, renamed from country.
Not worked outbronze computes nothingComputedby the job, from the fields beside
Where amount_usd came from
- 124.12amountthe raw row
- ×1.086356usd_ratebank_bronze.fx_rates
- =134.84amount_usdrounded to two places
In card-transactions-daily
.join(F.broadcast(fx), ["txn_date", "currency"], "left") F.round(F.col("amount") * F.coalesce(F.col("usd_rate"), F.lit(1.0)), 2)Computed
The amount times the rate of its currency on the day of the payment, here EUR on 2026-11-18. The rate comes by a left join and is not kept. With no rate the job multiplies by 1.0.
Where is_international came from
- INTERNATIONALscopethe raw row
- =trueis_international
In card-transactions-daily
F.col("scope") == "INTERNATIONAL"Computed
True when scope says INTERNATIONAL. Silver keeps the flag and drops the word.
Where is_night came from
- 18hourof txn_ts, 18:10:35 UTC
- <5the limit in the job
- =falseis_night
In card-transactions-daily
F.hour("txn_ts") < 5Computed
True for a payment made before 5 in the morning. This one was made at 18:10.
Where is_high_value came from
- 134.84amount_usdworked out above
- >=1500the limit in the job
- =falseis_high_value
In card-transactions-daily
F.col("amount_usd") >= 1500Computed
True from 1,500 dollars up. It reads amount_usd, so one limit holds for every currency.
Where risk_score came from
- 25is_internationaltrue
- +0is_nightfalse, 20 when true
- +0is_high_valuefalse, 30 when true
- +0channelCONTACTLESS, 10 for ECOM
- +0statusAPPROVED, 15 for DECLINED
- =25risk_scorecapped at 100
In card-transactions-daily
F.least( F.when(F.col("is_international"), 25).otherwise(0) + F.when(F.col("is_night"), 20).otherwise(0) + F.when(F.col("is_high_value"), 30).otherwise(0) + F.when(F.col("channel") == "ECOM", 10).otherwise(0) + F.when(F.col("status") == "DECLINED", 15).otherwise(0), F.lit(100))Computed
Five rules add up and the sum is capped at 100. This payment meets one: it crossed a border.
Where processed_at came from
- 2026-11-22T00:14:57Zprocessed_atwhen the job wrote the row
In card-transactions-daily
F.current_timestamp().alias("processed_at")Computed
The moment the job wrote the row. A later run for the same day rewrites that day, and this field with it.
The groupone row of the report for each day, state, category and channel
Where txn_date came from
- 2026-11-18txn_datebank_bronze.transactions
- =2026-11-18txn_datebank_silver.card_transactions, unchanged
In bank-gold-kpis
payments.groupBy( F.to_date("txn_date").alias("txn_date"), "customer_state", "category", "channel")Carried over, the report groups by it
The day of the payment, carried unchanged from the raw row. Every payment of the group was made on it.
Where customer_state came from
- K000029138card_idthe raw row
- →A000033994account_idbank_bronze.cards
- →C00024281customer_idbank_bronze.accounts
- →Californiastatebank_bronze.customers, in silver
In bank-gold-kpis
payments.groupBy( F.to_date("txn_date").alias("txn_date"), "customer_state", "category", "channel")Carried over, the report groups by it
The raw row never had it. Silver found it three tables away, and now it splits the report by state.
Where category came from
- M0042145merchant_idthe raw row
- →grocerycategorybank_bronze.merchants, in silver
In bank-gold-kpis
payments.groupBy( F.to_date("txn_date").alias("txn_date"), "customer_state", "category", "channel")Carried over, the report groups by it
The raw row never had it either. Silver looked it up by the merchant.
Where channel came from
- CONTACTLESSchannelbank_bronze.transactions
- =CONTACTLESSchannelbank_silver.card_transactions, unchanged
In bank-gold-kpis
payments.groupBy( F.to_date("txn_date").alias("txn_date"), "customer_state", "category", "channel")Carried over, the report groups by it
How the card was used, carried unchanged from the raw row.
The other 22 fields of the payment are not in gold. Three of them, status, amount_usd and risk_score, are read to count the group.
Its numbersover all 3,829 payments, and what this one puts in
Where payments came from
- 1this paymentone row of silver
- Σ3,829paymentsthe rows of the group
In bank-gold-kpis
F.count("*")Computed over the group
Counts the rows of the group. No field goes into it.
Where approved came from
- APPROVEDstatusbank_silver.card_transactions
- →1counted
- Σ3,752approvedof 3,829
In bank-gold-kpis
F.sum(F.when(F.col("status") == "APPROVED", 1) .otherwise(0))Computed over the group
Counts the payments whose status is APPROVED. 77 of the group were declined.
Where volume_usd came from
- 124.12amountbank_bronze.transactions, EUR
- ×1.086356usd_ratebank_bronze.fx_rates
- =134.84amount_usdbank_silver.card_transactions
- Σ334,569.99volume_usdwith 3,751 other approved
In bank-gold-kpis
F.round(F.sum(F.when(F.col("status") == "APPROVED", F.col("amount_usd"))), 2)Computed over the group
The dollars of the approved payments, added up. Silver converted each payment once, so gold adds dollars to dollars.
Where avg_ticket_usd came from
- 134.84amount_usdbank_silver.card_transactions
- avg88.96avg_ticket_usdover all 3,829, declined ones too
In bank-gold-kpis
F.round(F.avg("amount_usd"), 2)Computed over the group
The mean amount in dollars over every payment of the group. This one is above it.
Where decline_rate_pct came from
- APPROVEDstatusbank_silver.card_transactions
- →0.01.0 when DECLINED
- avg2.01decline_rate_pcttimes 100, over 3,829
In bank-gold-kpis
F.round(F.avg(F.when(F.col("status") == "DECLINED", 1.0) .otherwise(0.0)) * 100, 2)Computed over the group
The share of declined payments in percent: 77 of 3,829. This payment is not among them.
Where high_risk_payments came from
- 25risk_scorebank_silver.card_transactions
- >=50no, so 0
- Σ0high_risk_paymentsnone of the group reached 50
In bank-gold-kpis
F.sum(F.when(F.col("risk_score") >= 50, 1) .otherwise(0))Computed over the group
Counts the payments with a risk score of 50 or more. No payment of this group reached it.
3,829 paymentsone mark each
- 3,752 approved
- 77 declined
- this payment
Bronze is for keeping. The payment stays as the feed delivered it, so every table after it can be built again from the same rows. It answers no question yet: the card and the merchant are ids, and the amount is in euros.Silver is for reading. The job made the payment readable once, for everyone after it: ids followed through four tables, euros turned into dollars, a risk score. Rows without a card or a merchant were dropped, and each txn_id is kept once.Gold is for one question, here spend by day, state, category and channel. The payment has no row of its own any more. It is one of 3,829 behind one row, so a dashboard reads that row in place of 3,829.
This follows the values of one row. To see which columns feed which, trace a column on the lineage page. Both jobs are Spark jobs that Ilum starts on Kubernetes and runs on a schedule.
A framework to adapt, not a template to copy
The nature of your data and your pipelines should decide how you implement the layers. Name things the same way everywhere, validate at the same boundaries, and let the details differ.
Bronze is append-only, Silver is validated, Gold is shaped for its readers, and each is rebuilt from the one below.
A source that arrives clean may skip Silver.
A domain with many consumers may need several Gold tables from one Silver table.
Streaming sources land in Bronze through Structured Streaming and flow through the layers continuously.
In a data mesh, each domain owns its own Bronze-to-Gold path and publishes Gold as a data product.
A feature store for machine learning is a set of Gold tables with versioning and lineage.
How it works
Build it for one source and one report first, end to end. Then add sources.
01
Set up storage and land Bronze
Object storage, a catalog and a naming convention, then every source ingested with Spark into append-only Bronze tables.
02
Build the Silver pipelines
One cleansing and validation job per entity, with enforced schemas, deduplication and upserts with MERGE.
03
Shape Gold for its readers
Business-ready datasets for dashboards, feature tables for ML and self-service queries through Trino.
04
Monitor quality across layers
Freshness, row counts, duplicate rates and drift at every boundary, and a rebuild from Bronze when a bug gets through.
05
Adapt the model to your data
Add a layer where it earns its place and skip one where it does not.
Quality gates between layers
Validation runs where data crosses a layer, with Great Expectations, Deequ or your own checks. A failed check stops the load and leaves the previous version in place.
One Spark job at 02:00, every night
- Bronzetonight
- Silvertonightlast night
- Goldtonightlast night
- warn about what the head-end sent
- every meter has 96 intervals
- nothing is null
- the feeder totals equal the meters
Every check passes: tonight’s version replaces last night’s, and OpenLineage records which job wrote which table.
An error ends the job with exit code 1 and Ilum retries it. Silver and Gold keep last night’s version until it passes.
Lineage and access
OpenLineage records which job wrote which table from which inputs, down to columns, so lineage shows which raw records fed which report. Roles follow the layers: raw data for engineers, Gold for everyone who needs it.
Orchestration
Airflow schedules the dependencies between layers, dbt expresses the Silver-to-Gold transformations in SQL, and Spark does the heavy lifting. All of them run as modules on the same Kubernetes cluster.
Two medallion pipelines, table by table
Card payments of a bank and smart meter reads of a utility, as they run on Ilum. Analysts, BI tools and ML jobs read Gold through Trino or Spark SQL without touching the pipelines that produce it.
Bronzebank_bronze
- transactions
- fx_rates
- customers
- merchants
Silverbank_silver
- card_transactions
written by card-transactions-daily
Goldbank_gold
- daily_spend
written by bank-gold-kpis
Raw transactions, rates, customers and merchants, one cleaned and joined table, the daily spend report. Trace a column of it
Bronzepower_distribution
- bronze_interval_reads
Silverpower_distribution
- silver_interval_reads
- silver_outage_events
written by daily_transaction_etl.py
Goldpower_distribution
- gold_feeder_load_15min
- gold_reliability_daily
- gold_transformer_health
written by daily_transaction_etl.py, monthly_risk_scoring.py
Head-end reads land in bronze, validated quarter-hours in silver, feeder load and reliability in gold. The data platform for utilities
Moving to it from a warehouse or a data lake
In both cases the first risks are quality and performance, not technology. Validate at every layer from day one, test with production volumes before the cut-over, and scale a step at a time.
- 01Run the two in parallel
- 02Move one source at a time into Bronze
- 03Rebuild its Silver and Gold tables
- 04Compare the numbers before switching a report
Keep the old path until the new one has matched it for a full cycle, so the rollback is a configuration change.
- 01The files you have become Bronze
- 02Register them as Iceberg or Delta tables
- 03Add the catalog and the quality checks
- 04Build Silver on top
The raw history is already there.
Questions and answers
What is medallion architecture?
Medallion architecture is a design pattern that organizes a data lakehouse in bronze (raw), silver (cleansed) and gold (business-ready) layers. Data quality improves at each step, and every layer can be rebuilt from the one below it.
What are the benefits of medallion architecture?
Each layer has one job, so problems are found where they start: a bad source record is visible in Bronze before it reaches a dashboard. Raw data is kept, so any Silver or Gold table can be rebuilt. Governance is simpler because access rules follow the layers, and analysts and ML teams read Gold without touching the pipelines.
What is the difference between Silver and Gold layers?
Silver is the enterprise view: data cleansed, validated and enriched once, for everyone. Gold is the project view: the same data shaped for one consumer, such as a reporting dashboard or a feature table for a model.
Is medallion architecture suitable for small businesses?
Yes. Separating raw, validated and curated data applies to any organization. A small team can run a simplified version with DuckDB or single-node Spark and get the data quality without the infrastructure cost.
How does medallion architecture compare to data mesh?
They are complementary. Medallion defines the internal structure of a data product, how quality progresses from raw to curated. Data mesh defines the organizational structure, decentralized ownership by domain. A data mesh node often uses the medallion layers internally.
How do I build a medallion architecture on Ilum?
Build it for one source and one report first. Set up object storage, a catalog and a naming convention, ingest every source with Spark, in batches or with Structured Streaming, into append-only Bronze tables, and define access policies and monitoring before the first real load. Write one cleansing and validation job per entity: enforce schemas with evolution, deduplicate, upsert with MERGE, and add quality monitoring and reusable transformation templates with automated tests. Model Gold with dimensional modeling and pre-aggregation, point dashboards at it, build feature tables for ML, agree on freshness targets and open self-service queries through Trino. Track freshness, row counts, duplicate rates and drift at every boundary, alert when a gate fails, and rebuild from Bronze when a bug reaches Silver or Gold. Then add sources, and adapt the layers: streaming sources, domain ownership in a data mesh and feature stores all fit, as long as each layer still has one job.
What do I need to start?
A Kubernetes cluster and object storage: S3, MinIO, HDFS, Azure Blob or GCS, with tables in Iceberg, Delta or Hudi registered in Hive Metastore, Nessie or Unity Catalog. Spark for ingestion and transformation, Airflow for the dependencies and dbt for the SQL between Silver and Gold, all three modules of the Ilum Helm chart. And a first domain: one source system and one report that matters, built from Bronze to Gold before the next source.
Medallion architecture
Build the first layer on your cluster.
Install the Community edition, point it at your storage and land one source in Bronze. Spark, Airflow, dbt and lineage are in the same Helm chart. If you are moving off a warehouse or Hadoop, talk to an engineer first.
Contact
Tell us about your cluster.
Name one workload you want to move.
Tell us where it runs today.
We answer with a plan, not a deck.
We reply within two working days.