Data Lake Architecture — Data Engineering

A data lake stores data as files in object storage, raw and in its original format, with the schema applied when it is read (schema-on-read); a warehouse…

A courier's depot doesn't unpack incoming parcels. They're stored as they are on shelves labelled by date: cheap, room for anything, and nothing needs unpacking first. The shop at the front (the warehouse) only displays goods that have been tidied and priced. A depot whose shelves have no labels and whose contents nobody records slowly becomes a heap nobody dares touch. A data lake is that depot for data: it stores data as files in object storage (S3, GCS, Cloudflare R2, Azure Blob), in any format and in its original shape, so it is cheap to keep a lot of it and many engines can read it.

Lake, warehouse, lakehouse

Data warehouse Data lake Lakehouse
Holds cleaned tables any files: CSV, JSON, Parquet, logs, images Parquet files + table metadata
Schema checked when data is written (schema-on-write) applied when data is read (schema-on-read) checked on write, changes recorded
Where BigQuery, Snowflake, Redshift, a DuckDB file S3, GCS, R2 S3, GCS, R2
Read with that warehouse's engine DuckDB, Spark, Trino, pandas any engine that knows the table format

The main difference: a lake stores raw data in its original format and the schema is applied only when it is read; a warehouse stores structured data whose schema is checked on the way in. A lakehouse adds warehouse features (transactions, schema changes, old versions) on top of the lake's files.

Bronze, silver and gold layers

A lake is usually split into three layers (the medallion architecture). This is Bookshop's lake from one DuckDB 1.5.6 run on a laptop, with the real file sizes:

lake/
├── bronze/order_lines/              raw, CSV, exactly as extracted
│   ├── dt=2026-09-28/data_0.csv     306 bytes, 3 rows
│   ├── dt=2026-10-01/data_0.csv     301 bytes, 3 rows (item 9 still there)
│   └── ... (11 folders, 28 September to 9 October)
├── silver/sales/                    cleaned, Parquet
│   ├── dt=2026-09-28/data_0.parquet 1,152 bytes, 3 rows
│   ├── dt=2026-10-01/data_0.parquet 1,115 bytes, 2 rows
│   └── ... (11 folders too)
└── gold/weekly_winners.parquet      743 bytes, the owner's answer (9 rows)

Partitions: one folder per day

Partitioning means splitting data into folders by the value of one column. A folder is named column=value (Hive style), so a query engine knows what a folder holds without opening it. The script that built the lake above:

import os
import duckdb

for layer in ["bronze", "silver", "gold"]:
    os.makedirs(f"lake/{layer}", exist_ok=True)

con = duckdb.connect()

# Bronze: a raw copy as it is, CSV, one folder per day
con.sql("""
COPY (SELECT *, CAST(created_at AS DATE) AS dt FROM 'order_lines.csv')
TO 'lake/bronze/order_lines' (FORMAT csv, HEADER, PARTITION_BY (dt), OVERWRITE)
""")

# Silver: cleaned, Parquet, still one folder per day
con.sql("""
COPY (
  SELECT r.order_id, r.book_id, r.created_at,
         COALESCE(r.city, 'Unknown') AS city,
         r.title AS title, r.qty, b.catalog_price AS price, r.dt
  FROM read_csv('lake/bronze/order_lines/*/*.csv', hive_partitioning = true) r
  JOIN 'books.csv' b ON b.book_id = r.book_id
  QUALIFY ROW_NUMBER() OVER (PARTITION BY r.order_id, r.book_id ORDER BY r.item_id) = 1
)
TO 'lake/silver/sales' (FORMAT parquet, PARTITION_BY (dt), OVERWRITE)
""")

# Gold: the best seller per city per week from silver, COPY to
# lake/gold/weekly_winners.parquet (shortened)

Then a query on silver with a date filter. Silver has 11 files, one folder per day from dt=2026-09-28/ to dt=2026-10-09/. Guess first: how many files does DuckDB open for this query?

print(con.sql("""
SELECT dt, city, title, qty, price
FROM read_parquet('lake/silver/sales/*/*.parquet', hive_partitioning = true)
WHERE dt = '2026-10-01'
"""))

Its rows, then a slice of EXPLAIN ANALYZE for the same query:

│ 2026-10-01 │ London  │ This Earth of Mankind │     2 │    25 │
│ 2026-10-01 │ Bristol │ This Earth of Mankind │     1 │    25 │

│       File Filters:       │
│ (dt = '2026-10-01'::DATE) │
│                           │
│    Scanning Files: 1/11   │
│    Total Files Read: 1    │

DuckDB opens 1 of 11 files; the other 10 folders are skipped from their names alone. WHERE dt >= '2026-10-05' opens 5 of 11. WHERE city = 'Bristol' opens 11 of 11: the city isn't a partition column, so every file has to be read before filtering (the result is 5 rows). Choose the partition column from the filter used most often, usually the date.

Open table formats: Iceberg, Delta Lake, Hudi

A plain folder of Parquet files has no transactions. If COPY ... OVERWRITE dies halfway, some folders are new and some still old, and a query running at that moment reads the mix. An open table format adds metadata files beside the Parquet files that record which files make up the table's current version. Three are widely used (latest versions as of October 2026):

Format Version Origin
Apache Iceberg 1.12.0 (30 September 2026) Netflix, now an Apache project
Delta Lake 4.4.1 (5 October 2026) Databricks, now the Linux Foundation
Apache Hudi 1.2.1 (24 September 2026) Uber, now an Apache project

What all three add:

They are read and written with Spark, Flink, Trino or DuckDB (the iceberg and delta extensions), plus a catalogue that records which tables exist and where.

When Bookshop needs all this

Honestly: not yet. 19 order lines fit in one DuckDB file or one PostgreSQL replica, and the query finishes in milliseconds. Bookshop's silver is even bigger than its source: 11 Parquet files of about 1.1 KB each, nearly 12 KB in all, while order_lines.csv is only 1,491 bytes. Every Parquet file carries its own schema and metadata, and with 1 to 3 rows per file that cost dominates.

A lake starts to make sense once the data reaches gigabytes to terabytes, comes from many sources (click logs, app events, files from partners), includes data that isn't a table (cover images, PDFs), or several engines and teams must read the same data. A lakehouse makes sense when on top of that you need updates, deletes and old versions in the lake.

⚠️ How does a lake turn into a swamp?

TL;DR: A data lake stores data as files in object storage, raw and in its original format, with the schema applied when it is read (schema-on-read); a warehouse stores structured tables checked when written (schema-on-write); a lakehouse adds warehouse features on top of the lake's files. A lake is split into bronze (raw), silver (cleaned) and gold (ready to use), and partitioned into dt=2026-10-01/ folders: a filter on the partition column lets DuckDB open 1 of 11 files, a filter on another column still opens 11. Iceberg 1.12, Delta Lake 4.4 and Hudi 1.2 add ACID transactions, schema evolution and time travel. A lake without a catalogue, owners and quality checks becomes a data swamp. For data as small as Bookshop's, one database is enough; a lake pays off at gigabytes, many sources and many readers.

⚡ Lake versus warehouse

Meaning: A data lake stores raw data in its original format as files in object storage, and the schema is applied when it is read (schema-on-read). A warehouse stores structured data whose schema is checked when it is written (schema-on-write).

⚡ Bronze, silver, gold

Meaning: Bronze is the raw copy, never changed. Silver is the cleaned data. Gold is a ready-to-use table for one need, such as the best seller per city per week for the dashboard.

⚡ One folder per day

Write:

SELECT dt, city, title, qty, price
FROM read_parquet('lake/silver/sales/*/*.parquet', hive_partitioning = true)
WHERE dt = '2026-10-01'
Guess first: silver has 11 files, one folder per day. How many files does DuckDB open for this query?

Only 1 of 11. The other folders are skipped from their names alone. But WHERE city = 'Bristol' still opens 11 of 11, because the city isn't a partition column.

Meaning: Choose the partition column from the filter used most often, usually the date.

⚡ A lake turns into a swamp

Meaning: A lake without a catalogue, owners and quality checks turns into a data swamp: data piles up, nobody knows what's in it, and in the end nobody trusts it.

What you will learn