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
On this page
In plain words first
Think of two ways to store a family's documents.
A bank safe deposit box
A big storeroom of boxes
A storeroom with a librarian
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 feature | How 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 → transactions | Atomic 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, MERGE | Rewrite or mark files, then commit the new file list atomically |
| Schema enforcement and evolution | The schema is stored in table metadata and checked on write |
| Fast queries | File 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 audit | Old versions remain until cleaned up |
| Governance | A 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
-
Storage
S3, ADLS, GCS
-
File format
Parquet
-
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
-
Catalog
Names, permissions
-
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.
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'sDECIMAL(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.
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_logholds 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?"
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?"
Scenario"A company copies data from S3 into a warehouse every night, and the two disagree. How would a lakehouse change that?"
Trap"A lakehouse means we no longer need data modelling."
Check yourself
3 questionsWhat 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 readData 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
Open table formatsData lake & lakehouse · 7 min read
ACID on object storageData lake & lakehouse · 6 min read
The medallion architecture
Primary sources: Delta Lake documentation · Apache Iceberg documentation