Menu

Delta Lake course · Lesson 1 of 11

Data Lakes, Lakehouse Architecture and Delta Lake

Data lakes to lakehouse with Delta Lake: file and table formats, transactions, schema evolution, medallion layers, maintenance and governance in one guide.

  • Intermediate
  • Pillar guide
  • 9 min read
  • Updated Oct 2026
On this page
  1. Where Delta Lake fits in a data platform
  2. Core concepts
  3. A worked example: a lake folder becomes a table
  4. Delta Lake vs Apache Iceberg (and Hudi)
  5. What this course covers
  6. Medallion layers in one paragraph
  7. Common beginner mistakes
  8. What interviewers ask
  9. Key takeaway

A data lake stores files cheaply in object storage. A lakehouse adds the reliability of a warehouse on top of those files through an open table format such as Delta Lake, so the same copy of the data can serve BI, data engineering and machine learning. This guide connects the pieces and maps the course.

Where Delta Lake fits in a data platform

Delta Lake is not a database server or a query engine. It is a storage format and protocol: Parquet data files plus a _delta_log folder of commits, written and read by engines that implement the protocol.

  • Storage: your object storage (S3, ADLS, GCS) or HDFS. The data never leaves your account.
  • Engines: Apache Spark (through the delta-spark package), Databricks, and other engines with Delta connectors or the Delta Kernel libraries (for example Trino, Flink, DuckDB and Python’s deltalake package).
  • Catalog: a metastore or catalog (Hive Metastore, AWS Glue, Unity Catalog) maps table names to locations and, increasingly, coordinates commits and access control.
  • Pipelines: batch jobs and streaming queries write bronze, silver and gold Delta tables; BI tools and warehouses read the gold ones.
Every write is a version you can go back to

Delta table historythree commits

  1. Version 0WRITE: 3 rows
  2. Version 1DELETE: 1 row left
  3. Version 2RESTORE: 3 rows again

Old versions stay readable until VACUUM removes their files.

Core concepts

  • File format vs table format. Parquet is a file format: columnar, compressed, with per-row-group statistics. A folder of Parquet files is not a table: nothing says which files belong to it, and writes are not atomic. A table format adds that metadata layer.
  • The transaction log. Each write adds a numbered JSON commit (00000000000000000003.json) listing the files it added and removed plus schema and metadata changes. Every 10 commits by default (delta.checkpointInterval), a Parquet checkpoint summarises the table state so readers do not replay the whole history. The current table is whatever replaying the log produces.
  • ACID on object storage. A writer writes data files first (invisible, since no commit mentions them) and then atomically creates the next commit file; if that file already exists, it lost the race. Readers pick one version and read exactly its files (snapshot isolation). Concurrent writers use optimistic concurrency: a conflicting commit fails cleanly instead of corrupting the table. ACID covers one table at a time.
  • Schema enforcement and evolution. Writes whose schema does not match are rejected. Evolution (mergeSchema, ALTER TABLE ADD COLUMNS, column mapping, type widening) is opt-in.
  • Row-level changes. MERGE, UPDATE and DELETE rewrite only the affected files, or mark deleted rows with deletion vectors to avoid rewriting.
  • Time travel. Read an earlier version with versionAsOf or timestampAsOf, or RESTORE a table. It works only while both the log entries (kept 30 days by default) and the data files (removable by VACUUM once older than 7 days by default) exist.
  • Maintenance. OPTIMIZE compacts small files, liquid clustering or Z-order improves data skipping, and VACUUM deletes files no longer referenced by recent versions.

A worked example: a lake folder becomes a table

This runs locally with pip install pyspark delta-spark (matching versions: delta-spark 4.4 targets Spark 4.2; Java 17 or 21). It creates a Delta table, shows the log, rejects a bad write, applies a MERGE, and reads an older version.

import os, tempfile
from pyspark.sql import SparkSession
from delta import configure_spark_with_delta_pip
from delta.tables import DeltaTable

builder = (SparkSession.builder.master("local[2]").appName("lakehouse-pillar")
           .config("spark.sql.extensions", "io.delta.sql.DeltaSparkSessionExtension")
           .config("spark.sql.catalog.spark_catalog", "org.apache.spark.sql.delta.catalog.DeltaCatalog")
           .config("spark.sql.shuffle.partitions", "2"))
spark = configure_spark_with_delta_pip(builder).getOrCreate()
spark.sparkContext.setLogLevel("ERROR")
path = os.path.join(tempfile.mkdtemp(), "customers")

# Version 0: create the table
spark.createDataFrame([(1, "Asha", "Pune"), (2, "Ben", "Leeds")], "id INT, name STRING, city STRING") \
     .write.format("delta").save(path)
print(sorted(f for f in os.listdir(f"{path}/_delta_log") if f.endswith(".json")))

# Schema enforcement: a write with an unexpected column is rejected, nothing is committed
bad = spark.createDataFrame([(3, "Chen", "Oslo", "vip")], "id INT, name STRING, city STRING, tier STRING")
try:
    bad.write.format("delta").mode("append").save(path)
    raise AssertionError("expected a schema mismatch")
except Exception as e:
    assert "DELTA_METADATA_MISMATCH" in str(e) or "schema mismatch" in str(e).lower(), e
    print("rejected:", str(e).splitlines()[0][:80])

# Version 1: upsert a change feed in one atomic commit
changes = spark.createDataFrame([(2, "Ben", "York"), (3, "Chen", "Oslo")], "id INT, name STRING, city STRING")
(DeltaTable.forPath(spark, path).alias("t")
    .merge(changes.alias("s"), "t.id = s.id")
    .whenMatchedUpdateAll()
    .whenNotMatchedInsertAll()
    .execute())

current = {r.id: r.city for r in spark.read.format("delta").load(path).collect()}
before = {r.id: r.city for r in spark.read.format("delta").option("versionAsOf", 0).load(path).collect()}
print("now:", current, "version 0:", before)
assert current == {1: "Pune", 2: "York", 3: "Oslo"} and before == {1: "Pune", 2: "Leeds"}

ops = [(r.version, r.operation) for r in
       DeltaTable.forPath(spark, path).history().select("version", "operation").orderBy("version").collect()]
print(ops)
assert ops == [(0, "WRITE"), (1, "MERGE")]
spark.stop()

What to notice:

  • After version 0 the log holds one commit, 00000000000000000000.json. The rejected write did not create a commit, so it did not change the table; any data files it may have written are orphans that no reader sees and VACUUM later removes.
  • The MERGE updated one row and inserted another in one commit (version 1). A reader running at the same moment saw either version 0 or version 1, never a mix.
  • Version 0 is still readable because its files and log entry still exist. After VACUUM with the default retention, versions whose files were removed more than 7 days ago can no longer be read.

The deeper lessons take each of these apart: the log and ACID, what changes versus plain Parquet, and MERGE and the change data feed.

Delta Lake vs Apache Iceberg (and Hudi)

All three are open table formats on Parquet that give atomic commits, snapshots, schema evolution and row-level changes. The differences are in how metadata is organised and committed:

Delta Lake Apache Iceberg Apache Hudi
Metadata _delta_log of JSON commits plus Parquet checkpoints Tree of metadata file, snapshots, manifest lists and manifests Timeline of actions in .hoodie/ plus a metadata table
Atomic commit Atomic create of the next log file (or a catalog that coordinates commits) Catalog swaps a pointer to the new metadata file Timeline instant transitions, with locks for multiple writers
Partitioning Explicit partition columns, or liquid clustering Hidden partitioning with transforms, partition evolution Explicit partition paths, record keys and indexes
Strongest ecosystem Spark and Databricks Broad multi-engine support (Spark, Trino, Flink, warehouses) Spark and Flink streaming upserts

In practice the choice usually follows the platform: Databricks defaults to Delta, many multi-engine and warehouse-centred designs pick Iceberg, and compatibility layers let some engines read one as the other. The full comparison is in Delta Lake vs Apache Iceberg vs Apache Hudi, with a short interview version in Delta vs Iceberg vs Hudi.

What this course covers

  1. Data Lakes, Lakehouse Architecture and Delta Lake (this page): the map, core concepts and a worked example.
  2. Medallion Architecture: Bronze, Silver and Gold Layers Explained: what each layer is for, with a runnable bronze → silver → gold example.
  3. JSON vs Parquet for Analytics Pipelines: why landing formats and analytical formats differ, with size, pushdown and corrupt-record demos.
  4. Parquet vs Avro vs ORC: footers, row groups and statistics, codecs, and Avro schema resolution. Practise: Parquet internals.
  5. Delta Lake: Transactions, Schema Evolution and Time Travel: the log, checkpoints, ACID, optimistic concurrency, time travel, RESTORE, enforcement and evolution. Practise: What Delta Lake solves, Time travel uses and limits.
  6. Delta Lake vs Traditional Data Lake Tables: failure modes of plain Parquet, CONVERT TO DELTA, and a first look at Delta vs Iceberg vs Hudi.
  7. Delta Lake vs Apache Iceberg vs Apache Hudi: metadata, commits, partitioning, row-level updates and engine support compared, with Delta and Iceberg side by side on disk and a guide to choosing. Practise: Delta vs Iceberg vs Hudi.
  8. Delta Lake MERGE, Change Data Feed and Streaming: upserts, SCD Type 2 with MERGE, the change data feed, Delta as streaming source and sink. Practise: How MERGE works and why concurrent MERGEs fail.
  9. OPTIMIZE, Z-Ordering, VACUUM and Liquid Clustering: compaction, data skipping, deletion vectors and safe retention. Practise: Z-order vs liquid clustering, VACUUM risks.
  10. Schema Evolution: Safe Design Patterns: additive changes, expand-and-contract migrations, and contracts with producers. Practise: When schema evolution is safe.

Around the course: Lake vs warehouse vs lakehouse for the architecture choice (practise: When to choose each), Partitioning, clustering and data layout, medallion layers in Databricks workspace, jobs and lakehouse and modelling methodologies, and governance in Unity Catalog. Put it together in the scalable lakehouse case study, then build the Kafka → Spark → Delta streaming project.

Medallion layers in one paragraph

Organise tables into bronze (raw data as ingested, append-only, with ingestion metadata), silver (cleaned, typed, deduplicated and conformed) and gold (business-level facts, dimensions and aggregates). Each layer reads only the previous one and can be rebuilt from it, and quality checks sit between silver and gold. Delta’s transactions make each layer’s writes atomic; its time travel makes rebuilding and auditing practical. The full lesson, with a runnable example, is Medallion architecture: bronze, silver and gold.

Common beginner mistakes

  1. Calling a folder of Parquet files a lakehouse. Without a table format there are no transactions; readers can see partial writes.
  2. Writing to a Delta path with another tool. Copying or deleting files directly under a table bypasses the log and can corrupt it. Change data only through a Delta-aware engine.
  3. Running VACUUM with a short retention (and disabling the safety check) while streams, long queries or time-travel users still need old files.
  4. Over-partitioning. Partitioning a modest table by a high-cardinality column creates many tiny files; on new tables prefer liquid clustering.
  5. Never compacting streaming tables. Micro-batches create small files; schedule OPTIMIZE or use your platform’s automatic compaction.
  6. Turning on new table features without checking readers. Deletion vectors, column mapping or liquid clustering upgrade the protocol, and older readers or other engines may no longer read the table.
  7. Assuming multi-table transactions. A job that writes two tables can fail between them; design it to be safely re-run.
  8. Using mergeSchema by default instead of deliberate, reviewed schema changes.

What interviewers ask

Delta questions are also collected in the Top 50 Databricks interview questions (Delta internals, maintenance, MERGE and clustering) and the Top 100 data engineering interview questions. Strong answers describe the mechanism (the log, versions, file-level statistics), not just the feature names.

Key takeaway

A lakehouse is lake storage plus a table format. Delta Lake’s transaction log turns Parquet files into tables with atomic commits, schema enforcement, row-level changes and time travel; your job is to choose good layouts, maintain the tables, evolve schemas deliberately and let only Delta-aware engines write.

By , Data Engineer and Founder of DataDank · Last reviewed Oct 2026 · The example on this page and the linked lessons run locally on PySpark 4.2.0 with delta-spark 4.4.0 (open-source Delta), verified with scripts/verify-examples.py. Comparable capabilities exist in Apache Iceberg and Apache Hudi.

Progress is saved in this browser only. No account needed.

Search
Filter by type