databricks-spark-structured-streaming

Provides a production-grade guide for Spark Structured Streaming, suitable for building stream-processing pipelines, Kafka ingestion, implementing real-time modes, configuring triggers (e.g., processingTime, availableNow), using watermarks for stateful operations, optimizing checkpoints, performing stream-stream or stream-static joins, writing to multiple sinks, and tuning cost and performance of streaming.

Last repository push
GitHub Stars
212
Forks
664
Issues / PRs
21

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "databricks-spark-structured-streaming" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4b10ade6c08ef8a601bac31c9f1dbd8335bede0d9914d55cd100e0d57dca01c5. Verify the upstream source and version against https://github.com/Kilo-Org/kilo-marketplace before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Provides a production-grade guide for Spark Structured Streaming, suitable for building stream-processing pipelines, Kafka ingestion, implementing real-time modes, configuring triggers (e.g., processingTime, availableNow), using watermarks for stateful operations, optimizing checkpoints, performing stream-stream or stream-static joins, writing to multiple sinks, and tuning cost and performance of streaming.

0 Downloads

Introduction source: third_party · Kilo-Org · 0.1.0 Reference

SkillPi interpretation

Tasks
Comprehensive guide to Spark Structured Streaming for production workloads. Use when building streaming pipelines, working with Kafka ingestion, implementing Real-Time Mode (RTM), configuring triggers (processingTime, availableNow), handling stateful operations with watermarks, optimizing checkpoints, performing stream-stream or stream-static joins, writing to multiple sinks, or tuning streaming cost and performance.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: databricks-spark-structured-streaming
description: "Comprehensive guide to Spark Structured Streaming for production workloads. Use when building streaming pipelines, working with Kafka ingestion, implementing Real-Time Mode (RTM), configuring triggers (processingTime, availableNow), handling stateful operations with watermarks, optimizing checkpoints, performing stream-stream or stream-static joins, writing to multiple sinks, or tuning streaming cost and performance."
compatibility: Requires databricks CLI (>= v1.0.0)
metadata:
  version: "0.1.0"
parent: databricks-core

Spark Structured Streaming

Production-ready streaming pipelines with Spark Structured Streaming. This skill provides navigation to detailed patterns and best practices.

Quick Start

from pyspark.sql.functions import col, from_json

# Basic Kafka to Delta streaming
df = (spark
    .readStream
    .format("kafka")
    .option("kafka.bootstrap.servers", "broker:9092")
    .option("subscribe", "topic")
    .load()
    .select(from_json(col("value").cast("string"), schema).alias("data"))
    .select("data.*")
)

df.writeStream \
    .format("delta") \
    .outputMode("append") \
    .option("checkpointLocation", "/Volumes/catalog/checkpoints/stream") \
    .trigger(processingTime="30 seconds") \
    .start("/delta/target_table")

Core Patterns

Pattern Description Reference
Kafka Streaming Kafka to Delta, Kafka to Kafka, Real-Time Mode See references/kafka-streaming.md
Real-Time Mode (RTM) Sub-second E2E latency — cluster setup, slot math, supported ops (incl. stream-stream inner join on DBR 18+), transformWithState, observability, error classes, delivery semantics See references/real-time-mode.md
Lakebase Sink Write streaming records into Lakebase Postgres with transactional upserts. Native format("postgresql") sink (DBR 18.3+) and manual foreach sink as a fallback See references/lakebase-sink-python.md
Stream Joins Stream-stream joins, stream-static joins See references/stream-stream-joins.md, references/stream-static-joins.md
Multi-Sink Writes Write to multiple tables, parallel merges See references/multi-sink-writes.md
Merge Operations MERGE performance, parallel merges, optimizations See references/merge-operations.md

Configuration

Topic Description Reference
Checkpoints Checkpoint management and best practices See references/checkpoint-best-practices.md
Stateful Operations Watermarks, state stores, RocksDB configuration See references/stateful-operations.md
Trigger & Cost Trigger selection, cost optimization, RTM See references/trigger-and-cost-optimization.md

Best Practices

Topic Description Reference
Production Checklist Comprehensive best practices See references/streaming-best-practices.md

Production Checklist

  • [ ] Checkpoint location is persistent (UC volumes, not DBFS)
  • [ ] Unique checkpoint per stream
  • [ ] Fixed-size cluster (no autoscaling for streaming)
  • [ ] Monitoring configured (input rate, lag, batch duration)
  • [ ] Exactly-once verified (txnVersion/txnAppId)
  • [ ] Watermark configured for stateful operations
  • [ ] Left joins for stream-static (not inner)

Version history

  1. skills-20261103210927-6c1b454 GitHub ↗
    Original release notes

    Automated skills release from commit 6c1b4543cac1d45a80bf5904e4b69ac315117323

  2. skills-20260928190452-ff51758 GitHub ↗
    Original release notes

    Automated skills release from commit ff51758b06b8249007116184096765d47bdb7505

  3. skills-20260924105536-d31110d GitHub ↗
    Original release notes

    Automated skills release from commit d31110d62dc0bd00c22f1d6f6a630d1e702a0049

  4. skills-20260923085113-cea285e GitHub ↗
    Original release notes

    Automated skills release from commit cea285ef0e4d6ec47cd2fd9fdbca03813a3363c7

  5. skills-20260922193956-97d7333 GitHub ↗
    Original release notes

    Automated skills release from commit 97d7333d8200e5ac556c659c8669f3a83ba10866

Only the five most recent versions are shown. View full version history at the source ↗

Current listing version

0.1.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 提供 Spark Structured Streaming 生产级应用综合指南,涵盖 Kafka 数据摄取、实时模式、触发器配置、水印、检查点优化、流连接、多输出目标、成本性能调优等核心场景
  • 面向明确的生产级流处理需求,具有高频刚需和高实用价值
Trigger Precision95/100

Highlights

  • 触发词精准完整,覆盖 streaming pipelines、Kafka ingestion、RTM、triggers、watermarks、checkpoints、joins、multi-sink、cost/performance tuning 等多种变体
  • 边界清晰,无歧义
Structure and Standards95/100

Highlights

  • 结构清晰,分 Quick Start、Core Patterns、Configuration、Best Practices、Production Checklist 等章节
  • 包含端到端代码示例,frontmatter 完整,文档长度适中
Execution Reliability80/100

Areas to improve

  • 异常处理与确认机制未显式覆盖 Reported severity: Minor

    Quick Start 示例和核心模式未显式覆盖主要异常处理(如 Kafka 连接失败、检查点损坏等),也未提及不可逆操作的确认机制

    Recommendation: 建议在 Quick Start 或 Best Practices 中补充异常处理示例和不可逆操作的确认机制说明

Highlights

  • 工具来源明确(Spark, Kafka, Delta, Lakebase),参数正确
  • Quick Start 示例完整,可直接执行
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.