How rahul-dabholkar/uber-data-streaming-pipeline works
Purpose and Entry Points
This repository implements an Uber ride ingestion and analytics pipeline: batch lookup/reference data plus simulated real-time rides are transformed through bronze, silver, and gold Delta Live Tables (DLT) layers. Primary operational entry points are the event simulator/sender at scripts/connection.py, ride-event generation in scripts/data.py, Azure Data Factory metadata at config.json, and the Databricks DLT transformation set under databricks/uber-rides-ingestion-pipeline/transformations/.
Batch Reference-Data Ingestion
Azure Data Factory uses metadata in config.json to iterate over lookup datasets and copy JSON from HTTP/GitHub sources into ADLS Gen2’s raw/bronze storage. The mappings are represented locally by files such as data/map_cities.json, data/map_payment_methods.json, and data/map_vehicle_types.json. These static datasets become the enrichment side of the downstream stream-static join.
Real-Time Event Production Boundary
The local Python producer generates ride confirmations and occasional mutable customer/driver/location attributes, then publishes them to Azure Event Hubs using OAuth/connection configuration. scripts/data.py owns synthetic event generation, scripts/connection.py is the sender entry point, and scripts/send_force_ride.py emits controlled update events for SCD validation. Event Hubs is the boundary between producer runtime and Spark streaming ingestion.
Bronze Streaming and Historical Consolidation
DLT reads Event Hub through Spark’s Kafka connector in databricks/uber-rides-ingestion-pipeline/transformations/ingest.py, persisting raw event payloads as rides_raw. databricks/uber-rides-ingestion-pipeline/transformations/silver.py parses/normalizes streamed payloads and combines them with historical ride input, represented by data/bulk_rides.json, into the unified streaming staging relation stg_rides. This preserves a single downstream ride flow spanning backfill and live events.
Silver Enrichment and Late-Event Handling
databricks/uber-rides-ingestion-pipeline/transformations/silver-obt.sql produces the silver operational/business transformation by joining streaming stg_rides with static lookup tables. It applies a three-minute watermark on booking_timestamp, defining the late-arrival tolerance and limiting streaming state. The silver output is the canonical enriched ride event source for dimensional and fact modeling.
Gold Model and Stateful Analytics
databricks/uber-rides-ingestion-pipeline/transformations/model.py builds the gold star schema. It applies DLT CDC semantics: Type 2 history to passenger, driver, and location dimensions; Type 1 overwrite semantics to payment, vehicle, booking, and fact-oriented entities. The same stage calculates hourly city metrics with a one-hour window and ten-minute watermark, covering fare, completion, and cancellation behavior.
Runtime, Storage, and Governance
Azure Data Factory orchestrates batch ingestion; ADLS Gen2 supplies raw persisted storage; Azure Event Hubs provides live transport; Azure Databricks runs Spark/DLT transformations. Delta tables and Unity Catalog provide managed medallion storage, pipeline lineage, and governance. Databricks notebooks databricks/bronze-adls.ipynb and databricks/silver-obt.ipynb support interactive ingestion and result validation rather than serving as the main pipeline definition.
Main entry points: model.py Gold model · connection.py Event sender · silver.py stg_rides · silver-obt.sql Silver enrichment
Components 19
Sources
- HTTP/GitHub lookup data · Static city, payment, and vehicle reference sources.
- Lookup mappings
data/map_cities.json - Historical rides
data/bulk_rides.json - Ride event generator
scripts/data.py - Event sender
scripts/connection.py - Forced SCD events
scripts/send_force_ride.py
Azure ingestion
- ADF metadata
config.json - Azure Data Factory · Copies lookup JSON into raw storage.
- ADLS raw storage
- Azure Event Hubs · Boundary between local producers and streaming ingestion.
Databricks DLT
- Bronze event ingest · Reads Event Hubs through Spark Kafka connector.
databricks/uber-rides-ingestion-pipeline/transformations/ingest.py - rides_raw · Raw live-event payloads.
- stg_rides · Normalizes live payloads and unifies backfill with streaming rides.
databricks/uber-rides-ingestion-pipeline/transformations/silver.py - Silver enrichment · Stream-static join with a three-minute booking-time watermark.
databricks/uber-rides-ingestion-pipeline/transformations/silver-obt.sql - Enriched rides · Canonical enriched ride event source.
Gold analytics
- Gold model · Builds Type 1/2 dimensions, facts, and city metrics.
databricks/uber-rides-ingestion-pipeline/transformations/model.py - Gold star schema · SCD2 passenger, driver, and location; Type 1 operational entities.
- Hourly city metrics · One-hour windows with a ten-minute watermark.
- Unity Catalog · Governs managed Delta tables and pipeline lineage.
Connections 21
- HTTP/GitHub lookup data → Azure Data Factory: reference JSON
- Lookup mappings → Azure Data Factory: dataset mappings
- ADF metadata → Azure Data Factory: drives iteration
- Azure Data Factory → ADLS raw storage: copies lookup data
- Ride event generator → Event sender: ride and attribute events
- Forced SCD events → Event sender: controlled updates
- Event sender → Azure Event Hubs: publishes
- Azure Event Hubs → Bronze event ingest: Kafka streaming read
- Bronze event ingest → rides_raw: raw payloads
- rides_raw → stg_rides: parse and normalize
- Historical rides → stg_rides: backfill input
- stg_rides → Silver enrichment: unified ride stream
- ADLS raw storage → Silver enrichment: static lookup tables
- Silver enrichment → Enriched rides: canonical silver events
- Enriched rides → Gold model: model input
- Gold model → Gold star schema: CDC dimensions and facts
- Gold model → Hourly city metrics: windowed aggregates
- rides_raw → Unity Catalog: managed lineage
- Enriched rides → Unity Catalog: managed lineage
- Gold star schema → Unity Catalog: governed tables
- Hourly city metrics → Unity Catalog: governed metrics