# Medallion Architecture: Bronze, Silver, Gold

> What belongs in each layer, which rules apply where, and how the medallion pattern maps to raw, curated and published zones.

- Source: https://akshaythakare.com/notes/databricks/medallion-architecture
- Topic: Databricks
- Level: beginner
- Reading time: 1 min
- Tags: databricks, lakehouse, delta-lake, architecture, interview
- Updated: 2026-10-11

## Three layers

| Layer | Contains | Rules |
| --- | --- | --- |
| **Bronze** | Source data as received, plus ingestion metadata | Append-only, minimal parsing, keep everything |
| **Silver** | Cleaned, typed, deduplicated, conformed entities | Enforce schema and quality; one row per business key |
| **Gold** | Business aggregates and dimensional models | Shaped for dashboards, ML features and APIs |

```text
bronze.orders_raw  →  silver.orders  →  gold.daily_sales_by_store
```

## Why it works

- **Replay**: Bronze keeps the original data, so Silver and Gold can be rebuilt after a bug fix.
- **Separation**: Quality rules live in one place (Silver) instead of in every report.
- **Clear ownership**: Data engineers own Bronze and Silver; analytics engineers often own Gold.

## Typical Silver step (Delta)

```python
(spark.read.table("bronze.orders_raw")
   .filter("order_id IS NOT NULL")
   .withColumn("amount", F.col("amount").cast("decimal(18,2)"))
   .dropDuplicates(["order_id", "updated_at"])
   .write.mode("overwrite").saveAsTable("silver.orders"))
```

In production, Silver is usually updated incrementally with `MERGE` rather than overwritten.

> **Note: Same idea, different names**
>
> Raw / curated / published, or landing / staging / marts, are the same pattern. What matters is that each layer has a clear contract.
