Lakehouse Tables with Delta Lake

Add ACID transactions, schema enforcement, time travel and MERGE to files in object storage with Delta Lake, the table format behind Databricks.

Intermediate · about 6 hours · difficulty 3/5

Learn first: PySpark DataFrames, How Cloud Data Warehouses Work

Plain Parquet files in a lake cannot be updated safely: two jobs writing at once, or a job failing halfway, leave the data broken. Open table formats fix this, turning a folder of files into a real table. Delta Lake is the most common one in Spark-heavy and Databricks shops.

How it works

  • Data stays as Parquet files.
  • A transaction log (_delta_log) records every commit: which files were added or removed.
  • Readers see a consistent snapshot; writers use optimistic concurrency.

What you get

  • ACID transactions on object storage.
  • Schema enforcement and evolution: bad writes are rejected; new columns can be added deliberately.
  • MERGE, UPDATE, DELETE: upserts and GDPR or DPDP deletion requests become possible.
  • Time travel: query VERSION AS OF or TIMESTAMP AS OF.
  • Change data feed to read row-level changes downstream.

Maintenance

  • OPTIMIZE compacts small files; Z-ordering or liquid clustering co-locates related data.
  • VACUUM removes old files no longer referenced (this limits how far back time travel works).

Using it

Works with open source Spark (delta-spark), Databricks, and readers like DuckDB and Polars via delta-rs. The medallion architecture is usually implemented as Delta tables.

Pitfalls

  • Running VACUUM with a very short retention and breaking long-running readers or time travel.
  • Streaming jobs creating thousands of small files without regular OPTIMIZE.

You are ready to move on when you can create a Delta table with PySpark, MERGE daily updates into it, query an older version, and compact it with OPTIMIZE.

Key concepts

  • Transaction log
  • ACID on object storage
  • Schema enforcement and evolution
  • MERGE, UPDATE, DELETE
  • Time travel
  • OPTIMIZE and Z-order
  • VACUUM and retention
  • Change data feed

Other options for this step

Mini project

Build a bronze, silver, gold pipeline with PySpark and Delta Lake on your laptop: append raw orders to bronze, MERGE deduplicated records into silver, aggregate into gold. Demonstrate time travel to a previous version.

Check yourself

Two jobs write to the same plain Parquet folder at once and one fails halfway. What can readers see, and how does Delta's transaction log prevent it?

Free resources