databricks-spark-structured-streaming

Builds production Spark Structured Streaming pipelines on Databricks with Kafka ingestion and Delta sinks.

4|1|Updated May 22, 2026
One-click install
npx skills add https://github.com/ThomazRossito/ai-data-agents --skill databricks-spark-structured-streaming-thomazrossito
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: databricks-spark-structured-streaming
Source: https://github.com/ThomazRossito/ai-data-agents/tree/main/plugins/ai-data-agents/skills/databricks-spark-structured-streaming
Command: npx skills add https://github.com/ThomazRossito/ai-data-agents --skill databricks-spark-structured-streaming-thomazrossito

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building reliable streaming pipelines on Databricks requires navigating checkpoint management, trigger selection, stateful operations, joins, and multi-sink writes, where misconfiguration causes data loss, duplicates, or runaway costs. ## Core Features & Use Cases - Kafka Streaming Patterns: Ingest Kafka topics into Delta bronze layers, build Kafka-to-Kafka enrichment pipelines, and route events across multiple topics with DLQ validation. - Real-Time Mode (RTM): Configure sub-second latency streaming with correct cluster setup, slot math, supported operators, and error-class troubleshooting. - Stateful Operations & Checkpoints: Manage watermarks, state stores, checkpoint recovery, and exactly-once semantics with idempotent Delta writes. - Multi-Sink & Merge Operations: Fan out one stream to bronze/silver/gold tables, run parallel MERGE upserts, and write to Lakebase Postgres with transactional upserts. - Use Case: A data engineer needs a Kafka-to-Delta pipeline with deduplication, a 30-second trigger, and a persistent checkpoint on a Unity Catalog volume; this Skill provides the complete pattern plus a production checklist. ## Quick Start Ask the agent to create a Spark Structured Streaming pipeline that reads from a Kafka topic and writes to a Delta table with checkpointing and a processing-time trigger.

Frequently Asked Questions about databricks-spark-structured-streaming

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stream from Kafka to Delta Lake on Databricks?▼

Use spark.readStream with the kafka format, parse the JSON value column with from_json, and write with writeStream in delta format using append mode. Set a persistent checkpointLocation on a Unity Catalog volume and a processingTime trigger such as 30 seconds.

What is Real-Time Mode in Spark Structured Streaming?▼

Real-Time Mode is a Databricks execution mode that processes records continuously instead of micro-batches, achieving sub-second end-to-end latency. It requires DBR 16.4 LTS or later, Classic compute, fixed-size clusters, Photon off, and outputMode update with a realTime trigger.

Does Spark Structured Streaming support writing to multiple sinks?▼

Yes, use foreachBatch to write one stream to multiple Delta tables or Kafka topics with a single checkpoint. Each write must set txnVersion to the batch_id and a unique txnAppId so retries stay idempotent, since foreachBatch writes are not atomic across sinks.

Why is my streaming checkpoint corrupted or lost?▼

Checkpoint corruption usually comes from file system issues, manual deletion, or sharing one checkpoint between streams. Delete the checkpoint folder, restart with startingOffsets set to earliest, and rely on idempotent Delta writes to deduplicate reprocessed data.

Can I use autoscaling clusters for Structured Streaming?▼

No, streaming workloads require fixed-size clusters because autoscaling disrupts stateful processing and Real-Time Mode explicitly disables it. Size the cluster so total worker vCPUs meet or exceed the sum of partitions across every pipeline stage.

How do I write streaming data into Lakebase Postgres?▼

On DBR 18.3 or later use the native format postgresql sink with outputMode update, which handles batching, retries, and workspace-managed authentication. On older runtimes use a manual foreach sink with INSERT ON CONFLICT upserts and password authentication from a secret scope.