Skip to content
Bronze 6 min read · All formats 2 practice problems ↓

Lake, warehouse, lakehouse

Companies used to choose between a warehouse, tidy and fast but expensive and closed, and a data lake, cheap and open but messy. The lakehouse tries to give you both. This lesson shows what each side gets right, and what the lakehouse borrows from each.

Step 3 · Data lake & lakehouse · Bronze · Lake foundations, lesson 1 of 3

In plain words first

Think of two ways to store a family's documents.

A bank safe deposit box

Everything is neat, indexed and secure, and staff fetch what you ask for. But only the bank can open it, and every drawer costs money. That is a warehouse.

A big storeroom of boxes

Cheap, holds anything, and anyone can walk in. But nobody knows which box is the latest version. That is a data lake.

A storeroom with a librarian

The same cheap boxes, plus a register of what is current, so you get order without the bank. That is a lakehouse.

The warehouse

A data warehouse (Teradata, Redshift, Snowflake, BigQuery, Synapse) stores data in its own managed format and gives you SQL with transactions, a schema, indexes or clustering, access control and good performance. The costs: data must be loaded into it, storage and compute are typically priced per vendor, machine learning and Python workloads need the data exported, and the format belongs to the vendor.

The lake

A data lake is object storageobject storage: Cloud file storage such as Amazon S3, Azure Data Lake Storage or Google Cloud Storage: cheap and huge, but with no transactions of its own. Learn more → (S3, ADLS, GCS) holding files in open formats: CSV, JSON, ParquetParquet: A columnar file format: values of each column are stored together, so queries read only the columns they need. Learn more →, images, logs. Storage is very cheap and any engine can read it: Spark, Trino, pandas, ML frameworks. But a folder of files is not a table:

  • No transactions: a failed job leaves half-written files that readers see.
  • No safe updates or deletes: changing one row means rewriting files, with readers seeing in-between states.
  • No schema enforcement: a job writing a wrong type silently corrupts the table.
  • Slow listing and no statistics, so queries scan far more than needed.

Many lakes turned into "data swamps": nobody trusted the data enough to use it.

The lakehouse

The lakehouse keeps the lake's storage and formats and adds a metadata layer that records exactly which files form each version of a table. That one idea brings back warehouse features:

Warehouse featureHow the lakehouse gets it
ACIDACID: Atomicity, consistency, isolation and durability: the guarantees that make a write all-or-nothing and safe with other readers and writers. Learn more → transactionsAtomic commitscommit: One atomic change to a table: a new version that lists which files were added and removed. Learn more → to a transaction logtransaction log: The ordered list of commits that defines which files make up a Delta table at each version. Learn more → or metadata tree
Updates, deletes, MERGERewrite or mark files, then commit the new file list atomically
Schema enforcement and evolutionThe schema is stored in table metadata and checked on write
Fast queriesFile statistics, clustering and compactioncompaction: Rewriting many small files into fewer large ones, without changing the rows. Learn more → for data skipping
Time traveltime travel: Reading a table as it was at an earlier version or time. Learn more → and auditOld versions remain until cleaned up
GovernanceA catalogcatalog: The service that maps table names to their current metadata and controls who can access them. Learn more → (Unity Catalog, Polaris, Glue, Hive Metastore) for names and permissions

The stack

  1. Storage

    S3, ADLS, GCS

  2. File format

    Parquet

  3. Table formattable format: A metadata layer (Delta Lake, Iceberg, Hudi) that turns a folder of data files into a table with commits, versions and a schema. Learn more →

    Delta, Iceberg, Hudi

  4. Catalog

    Names, permissions

  5. Engines

    Spark, Trino, Flink, warehouses

Because every layer is open, several engines can work on the same tables: Spark for ETL, Trino for interactive SQL, a warehouse reading Iceberg directly, Python for ML, without copying data.

When it is not the answer

  • Small data with simple reporting: a managed warehouse or even PostgreSQL is less to operate.
  • Very high-frequency single-row updates and lookups: that is an OLTP database's job.
  • Teams without the skills to run maintenance (compaction, cleanup, statistics): managed platforms do this for you; self-managed lakehouses need it done.

Try it yourself

Each example says what it shows, then the output from a real run and what to notice in it, so you can follow without running anything. To try one yourself, paste it into a local Spark session with Delta Lake, with spark already created: each builds its own data.

Goal: Create a Delta table with SQL, write rows to it, and query it.

Production patternPySpark · Create a Delta table with DDL, write to it, query it with SQL
import os

# delta.`...` in SQL needs an absolute path
path = os.path.abspath("lab/basics/sales")
spark.sql(f"""
    CREATE OR REPLACE TABLE delta.`{path}` (
        order_id BIGINT NOT NULL,
        country  STRING,
        amount   DECIMAL(10, 2),
        order_ts TIMESTAMP
    ) USING delta
    COMMENT 'Orders, one row per order'""")

orders = spark.createDataFrame(
    [(1, "IN", 120.50, "2025-03-01 10:00:00"), (2, "US", 80.00, "2025-03-01 11:30:00")],
    "order_id BIGINT, country STRING, amount DOUBLE, order_ts STRING")
(orders.selectExpr("order_id", "country",
                   "CAST(amount AS DECIMAL(10, 2)) AS amount",
                   "CAST(order_ts AS TIMESTAMP) AS order_ts")
       .write.format("delta").mode("append").save(path))

spark.sql(f"""
    SELECT country, SUM(amount) AS revenue
    FROM delta.`{path}`
    GROUP BY country ORDER BY country""").show()

Output from a real run

+-------+-------+
|country|revenue|
+-------+-------+
|     IN| 120.50|
|     US|  80.00|
+-------+-------+

What to notice:

  • Revenue shows two decimals (120.50): the table's DECIMAL(10, 2) type was kept on write.
  • The table lives in a folder; you query it with delta.`path` like any table.

Goal: Look inside a Delta table's folder: data files plus a log of commits.

ExplorePySpark · What is on disk: Parquet files plus a log
import glob, os

path = os.path.abspath("lab/basics/orders")
orders = spark.createDataFrame([(1, "ana", 120.0), (2, "bo", 75.5)],
                               ["id", "customer", "amount"])
(orders
      .write.format("delta").mode("overwrite").save(path))
spark.sql(f"UPDATE delta.`{path}` SET amount = amount * 2 WHERE id = 1")

for f in sorted(glob.glob("lab/basics/orders/**", recursive=True)):
    if os.path.isfile(f) and not f.endswith(".crc"):
        print(f)

print("now:")
spark.read.format("delta").load(path).orderBy("id").show()
print("version 0, before the update:")
spark.read.format("delta").option("versionAsOf", 0).load(path).orderBy("id").show()

Output from a real run

lab/basics/orders/_delta_log/00000000000000000000.json
lab/basics/orders/_delta_log/00000000000000000001.json
lab/basics/orders/part-00000-7f760b2b-936d-4907-8d01-8efe920829d0-c000.snappy.parquet
lab/basics/orders/part-00000-ad300c31-317f-4a6a-8a88-ccdf160414e5-c000.snappy.parquet
lab/basics/orders/part-00001-9ed45528-ccf9-48e6-9f60-271979d87a1c-c000.snappy.parquet
lab/basics/orders/part-00003-b1c92c73-af42-4fa9-a46e-953d6b0728d4-c000.snappy.parquet
now:
+---+--------+------+
| id|customer|amount|
+---+--------+------+
|  1|     ana| 240.0|
|  2|      bo|  75.5|
+---+--------+------+

version 0, before the update:
+---+--------+------+
| id|customer|amount|
+---+--------+------+
|  1|     ana| 120.0|
|  2|      bo|  75.5|
+---+--------+------+

What to notice:

  • _delta_log holds two commits: …000.json (the write) and …001.json (the update).
  • The update wrote a new Parquet file but left the old ones there. The log, not the folder, decides which files make up the table.
  • That is why version 0 can still be read: Ana's amount is 120.0 there and 240.0 now.

Common mistakes

  • Thinking Parquet alone makes a lakehouse — Parquet is a file format. Without a table format there are no transactions.
  • Treating lakehouse tables like OLTP tables — Frequent tiny updates create many small files and long logs.
  • Skipping table maintenance — Compaction and cleanup are part of running a lakehouse.

Key takeaways

  • Warehouses are reliable but closed; lakes are open and cheap but unreliable.
  • A lakehouse adds a table format over lake files to get transactions and schemas.
  • The stack: object storage, Parquet, a table format, a catalog, many engines.
  • It needs maintenance and is not a replacement for OLTP databases.

Interview prep

THE QUESTION

"What is a lakehouse and why did the industry move toward it?"

Open files on cheap object storage plus a table format providing ACID transactions, schema enforcement, updates and time travel, plus a catalog for governance. Motivation: avoid copying data from lakes into warehouses, use one copy with many engines (SQL, Spark, ML), keep data in open formats, and separate storage from compute. A good answer names Delta, Iceberg and Hudi and mentions maintenance as the trade-off.

Avoid: "a data lake with SQL on top". The defining piece is the table format: transactions, schema enforcement and versioning over open files.

Follow-ups · answer out loud, then open

Follow-up"What does a warehouse still do better than a lakehouse?"
Very low-latency, high-concurrency BI queries with managed caching and indexing, mature workload management, and fully managed tuning. Lakehouse engines are closing the gap, but a candidate who says "nothing" has not run both.
Scenario"A company copies data from S3 into a warehouse every night, and the two disagree. How would a lakehouse change that?"
Keep one copy in an open table format on object storage, governed by one catalog, and point both Spark jobs and SQL engines at it. No nightly copy means no drift and no double storage. The warehouse can still read the same tables if it supports the format (Iceberg or Delta).
Trap"A lakehouse means we no longer need data modelling."
Modelling still matters: dimensional or wide gold tables, clear keys, slowly changing dimensions. The lakehouse changes where the data lives and how it is transacted, not the need to design it.

Check yourself

3 questions

What turns a folder of Parquet files into a transactional table?

Show the answer

A table format such as Delta Lake or Iceberg. The table format's metadata defines which files are in each version and commits atomically.

Which is a typical weakness of a plain data lake?

Show the answer

No atomic writes: readers can see half-written data. Without transactions, partial writes are visible.

Which workload is a poor fit for a lakehouse?

Show the answer

Thousands of single-row updates per second. That is OLTP; each tiny commit adds files and log entries.

Practise this

Interview problems on data lake, graded on hidden tests

Keep going

Up next · Lake foundations · lesson 2 of 3 · 7 min read
Data lake storage: formats and layout
CSV, JSON, Avro, ORC and Parquet compared, compression, and how to lay out folders in a data lake.

Related lessons

Primary sources: Delta Lake documentation · Apache Iceberg documentation