All projects
03Streaming · Spark Structured Streaming

Real-Time Weather Stream

Events flow from Azure Event Hubs into Databricks, are refined continuously through Delta Lake layers and land in a Power BI report in near real time.

5 min

aggregation windows

≤ 20 min

latency to Power BI

3

Delta layers in Unity Catalog

Platform

Azure Databricks

Stack

  • Azure Event Hubs
  • Azure Databricks
  • Spark Structured Streaming
  • Delta Lake
  • Unity Catalog
  • Power BI

Context

In this project I built a scalable pipeline with Azure Event Hubs and Databricks to process streaming data in near real time. Event streams from sources such as Kafka or IoT devices are ingested into Event Hubs and processed with Spark Structured Streaming, then stored in a Delta lakehouse following the Medallion architecture.

Bronze keeps the raw events for traceability, Silver cleans and structures them for querying, and Gold aggregates them for analytics — a design that stays flexible and fast with large volumes of real-time data.

Finally, the data is exposed to Power BI in DirectQuery, powering dashboards that refresh in near real time with a maximum latency of 20 minutes.

Solution architecture

  1. Event Hubs
  2. Bronze
  3. Silver
  4. Gold
  5. Power BI
  1. Step 01Source

    Azure Event Hubs

    I created an Event Hubs resource in an Azure resource group. Event Hubs is the ingestion layer, able to absorb high-throughput event streams in real time.

    Events are synthetic, generated with the Event Hubs Data Explorer: JSON messages, each representing a single record as key-value pairs — like a row in a table.

  2. Step 02Landing

    Azure Databricks connected to Event Hubs

    A Databricks workspace is created in the same resource group, with a compute cluster to process the stream. The Azure Event Hubs connector library is installed on the cluster so that Spark Structured Streaming can read events efficiently.

  3. Step 03Bronze

    Starting the stream — Bronze layer

    Medallion structure in Unity Catalog

    In a Databricks notebook, I first create the catalog and the bronze, silver and gold schemas so that data is ingested, processed and refined in a structured way.

    Connecting to Event Hubs

    The connection is configured with the Event Hubs namespace, hub name and access key.

    Reading the stream

    Spark Structured Streaming then reads and displays the incoming events.

    Persisting to Delta

    With readStream alone, data only lives in memory and disappears when the stream stops. Using writeStream, events are persisted to the Bronze layer in Delta format, so they remain available for processing and analysis.

  4. Step 04Silver

    Silver layer — parsing & cleaning

    In Bronze, each event payload sits in a binary body column. To make it queryable, it has to be decoded and structured.

    1. Binary to string

    The body column is converted to a string with cast().

    2. Parsing the JSON

    A schema is defined with PySpark StructType and StructField, then from_json() turns the string into structured columns.

    3. Writing the Silver table

    writeStream saves the structured data to the Delta table streaming.silver.weather, processing it incrementally so new events keep flowing in without overwriting existing records.

  5. Step 05Gold

    Gold layer — 5-minute aggregates

    The Silver stream is aggregated over 5-minute windows to produce summarised metrics that are ready for reporting.

    The aggregates are persisted to streaming.gold.weather_summary for efficient querying.

  6. Step 06Orchestration

    Pipeline recap

    • →Event Hubs ingests real-time JSON events, streamed continuously into Databricks.
    • →Bronze keeps the raw events in their original form.
    • →Silver decodes binary records into structured JSON and extracts weather attributes such as temperature, humidity and wind speed.
    • →Gold computes 5-minute averages for each metric, ready for visualisation.
  7. Step 07Serving

    Real-time Power BI report

    Power BI connects through Databricks Partner Connect, which provides a connector bound to the cluster. Power BI queries the Gold layer directly, so reports stay up to date in near real time.

    The report shows two views: the Silver layer with cleaned events, and the Gold layer with metrics aggregated over 5-minute intervals. Users filter by time and explore temperature by weather condition (Cloudy, Partly Cloudy, Sunny).

Summary

This project delivers a complete real-time pipeline with Azure Event Hubs, Databricks and Power BI, following the Medallion architecture to turn raw events into insights.

  • →Bronze — JSON weather events streamed from Event Hubs are stored unchanged in a Delta table.
  • →Silver — binary payloads are parsed into readable, typed columns.
  • →Gold — 5-minute aggregates of temperature, humidity, wind speed and precipitation make trends and anomalies easy to spot.

Delivered to Power BI via Partner Connect, the data powers an interactive dashboard with time-based filters and condition-based analysis — a scalable approach to continuous data streams.

Next project · 01

NYC Taxi Analytics

Batch pipeline · Data warehouse