Azure Databricks, ADLS Gen2 Pipeline

PySpark, Spark SQL, Delta Lake, ADLS Gen2

View on GitHub

Screenshot 1 of 1

Bronze / Silver / Gold ETL on Azure Databricks

Context

Airbnb publishes its city data as three loosely related exports: a listings file, a calendar of nightly prices and availability, and neighbourhood geometry as GeoJSON. None of them answers a pricing or occupancy question on its own, and the calendar file is large enough that joining it ad hoc stops being practical. I built a pipeline that lands all three in one place and models them into a schema that can be queried directly.

Constraints

  • Three sources with different shapes. Listings and calendar are tabular, neighbourhoods are GeoJSON, and none answers a pricing or occupancy question alone.
  • A calendar file too large to join ad hoc. The model has to be built once and queried, not re-derived per question.
  • A raw zone that stays faithful. What arrived has to remain recoverable after the cleaning logic changes.
  • Re-runs have to be safe. A notebook that fails halfway must not leave a half-written table for the next layer to read.

What I built

Azure Databricks: PySpark, Spark SQL Sources listings.csv calendar.csv neighbourhoods Bronze raw, as landed no transforms Parquet Silver deduplicate normalise ยท enrich Delta Gold star schema aggregates Delta Analysis Spark SQL notebooks all three layers persisted to ADLS Gen2, Delta Lake for ACID writes

Three notebooks, one per layer. Bronze ingests the listings, calendar and GeoJSON files and writes them to ADLS Gen2 as Parquet with no transformation, so the raw zone stays a faithful copy of what arrived. Silver deduplicates, normalises types and enriches records, producing tables that are structurally sound enough to query. Gold models the cleaned data into a star schema and materialises the aggregates that the analysis actually reads.

Delta Lake sits under Silver and Gold, which is what makes a re-run safe: writes are atomic, so a notebook that fails halfway does not leave a half-written table for the next layer to read.

Design choices

Three layers. Bronze is stored exactly as it arrived, Silver holds the cleaned records and Gold holds the model the analysis reads. Cleaning on ingest would be shorter, but a mistake in a transform could then only be fixed by fetching the files again. With Bronze untouched, Silver and Gold can be rebuilt from it.

Delta Lake under Silver and Gold. Delta writes are atomic, so a failed notebook leaves the previous table version in place instead of a partial one. Bronze stays plain Parquet because it is written once and never updated.

A star schema in Gold. Listings, calendar days and neighbourhoods have different grains. Flattening them into one table repeats listing and neighbourhood attributes on every calendar row. A fact table with small dimensions keeps each attribute in one place and keeps the aggregates cheap to read.

Next steps

  • Tests between layers. Uniqueness on listing IDs and not-null checks on prices at the Silver boundary, so bad data stops there instead of reaching Gold.
  • Orchestration. The three notebooks run as a sequence. A scheduled job with failure alerts would remove the manual step.
  • File compaction. An OPTIMIZE step on the Delta tables, so the number of small files does not grow with each run.

Stack

PySpark, Spark SQL, Delta Lake, Azure Databricks, Azure Data Lake Storage Gen2, Parquet