Skip to main content

Build

Databricks Pipelines

DatabricksOfficialCertified

Spark Declarative Pipelines (formerly DLT) in Python or SQL: streaming tables, materialized views, expectations, Auto CDC, Auto Loader, and pipeline settings. Also covers continuous mode, run-as, parameters, rewind, views, sinks and ForEachBatch, append flows, pipeline setup, migrating from legacy DLT, cluster keys, streaming state, and dedup or windowed aggregations. Also file ingestion from volumes, cloud storage, SFTP, Google Drive, SharePoint or OneDrive and document parsing; debugging failed, slow, or flaky updates from the update history; migrating dbt or Informatica projects to SDP; authoring community connectors; and Python unit testing and notebook refactoring.

  • New
  • v1.0.10
  • Reviewed Jul 21
  • No reviews yet

Capabilities

  • Decision Tree

    Use this tree to choose the dataset type first, then layer on…

  • Publishing Modes

    Pipelines publish to the default catalog/schema in their settings

  • Comprehensive API Reference

Getting started

Full instructions

Install the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.

Instructions: SKILL.mdv1.0.10

Spark Declarative Pipelines

Core syntax and rules for writing Spark Declarative Pipelines datasets.

Decision Tree

Use this tree to choose the dataset type first, then layer on applicable features. Multiple features can apply to the same dataset — e.g., a Streaming Table can use Auto Loader for ingestion, Append Flows for fan-in, and Expectations for data quality.

text
User request → What kind of output?
├── Intermediate/reusable logic (not persisted) → Temporary View (default)
│   ├── Preprocessing/filtering before Auto CDC → Temporary View feeding CDC flow
│   ├── Shared intermediate streaming logic reused by multiple downstream tables
│   ├── Pipeline-private helper logic (not published to catalog)
│   ├── Expensive intermediate that is reused across refreshes → Private ST/MV (materialized but pipeline-scoped)
│   └── Published to UC for external queries → Persistent View (SQL only)
├── Persisted dataset
│   ├── Source is a periodic complete snapshot that must be diffed by key → Streaming Table + Auto CDC FROM SNAPSHOT
│   ├── Source is streaming/incremental/continuously growing → Streaming Table
│   │   ├── File ingestion (cloud storage, Volumes) → Auto Loader (see file-ingestion-and-processing skill)
│   │   ├── Message bus (Kafka, Kinesis, Pub/Sub, Pulsar, Event Hubs) → streaming source read
│   │   ├── Existing streaming/Delta table → streaming read from table
│   │   ├── CDC / upserts / track changes / keep latest per key / SCD → AUTO CDC for owned targets; external upserts → ForEachBatch Sink.
│   │   ├── Source rows carry two timestamps with different semantic meaning — one for when the fact holds in the domain, the other for when the system learned or recorded it (e.g. effective_at + ingested_at, trade date + booking date, observation time + chart-entry time) → Auto CDC STORED AS BITEMPORAL; read references/auto-cdc-python.md or references/auto-cdc-sql.md first.
│   │   ├── Multiple sources into one table → Append Flows (NOT union)
│   │   ├── Historical backfill + live stream → one-time Append Flow + regular flow
│   │   ├── Recompute/overwrite a bounded window or partition each run (late-arriving within a known lookback, rolling last-N-days aggregate, partition overwrite, scheduled re-runs) → REPLACE WHERE flow (NOT a Materialized View, plain streaming table, or full recompute)
│   │   ├── Streaming source re-emits all rows for a key and the latest should replace the old per key (re-ingesting mutable files, keyed in-place updates) → REPLACE USING flow (NOT Auto CDC, which is for change events/SCD; NOT REPLACE WHERE, which overwrites a predicate window not a key)
│   │   └── Windowed aggregation with watermark → stateful streaming
│   └── Source is batch/historical/full scan → Materialized View
│       ├── Aggregation/join across full dataset (GROUP BY, SUM, COUNT, etc.)
│       ├── Gold layer aggregation from streaming table → MV with batch read (spark.read / no STREAM)
│       ├── JDBC/Federation/external batch sources
│       └── Small static file load (reference data, no streaming read)
├── Output to a target the pipeline does NOT own (external / pre-existing / managed elsewhere) → Sink (Python only, primary even if the user asked for SQL)
│   ├── External or pre-existing Delta table NOT owned by this pipeline → Sink with format="delta" (streaming tables/MVs are for tables this pipeline owns and manages — including ones it already created and refreshes each run — but they cannot write into a table owned outside the pipeline)
│   ├── Kafka / Event Hubs → Sink with format="kafka" + @dp.append_flow(target="sink_name")
│   ├── Custom destination not natively supported → Sink with custom format
│   ├── Custom merge/upsert into an existing/external table → ForEachBatch Sink, NOT Auto CDC
│   └── Multiple destinations per batch → ForEachBatch Sink
└── Data quality constraints → Expectations (on any dataset type)

Common Traps

  • Changing dataset type (ST↔MV): Read changing-dataset-type BEFORE edits or commands. Create a NEW dataset name and repoint ALL downstream references; never convert in place. Full refresh cannot fix this. The platform's "drop first" message is a manual workaround; offer dropping only as a follow-up. A green dry run does not prove rewiring.
  • SCD Type 2 queries: Use validity columns __START_AT / __END_AT, not invented names. Point-in-time predicate: __START_AT <= t AND (__END_AT > t OR __END_AT IS NULL); temporal joins also match the key and use the event date as t. See references/auto-cdc-sql.md.
  • UNRESOLVED_COLUMN / UNRESOLVED_COLUMN.WITH_SUGGESTION: Verify upstream columns. For Auto Loader, verify its schema includes them (e.g., via cloudFiles.schemaHints / schemaHints); read auto-loader-schema.
  • Existing ST column add/drop/rename/widen, DELTA_MERGE_INCOMPATIBLE_DATATYPE or DELTA_FAILED_TO_MERGE_FIELDS: Read streaming-table-schema-evolution before answering; ALTER TABLE is Beta with prerequisites.
  • Resizing an existing stateful flow: Set spark.sql.streaming.stateStore.partitions (not spark.sql.shuffle.partitions); no full refresh. See streaming-table-python.
  • SQL parameters (DBR 17.0+): Read parameters-sql before writing. Use :name for values that vary across updates, not hardcoding or legacy ${name}. Values are STRING: cast at use; identifiers need IDENTIFIER().
  • Recommend one approach. Omit anti-patterns and inferior alternatives; mention alternatives only for viable trade-offs.

Publishing Modes

Pipelines publish to the default catalog/schema in their settings.

  • Use dataset-only names for pipeline reads/definitions unless existing code or the user requests qualification.
  • catalog.schema.table publishes a pipeline-owned dataset elsewhere; no sink needed. External, pre-existing, or separately managed targets require a Python sink, even if the user requested SQL.
  • USE CATALOG / USE SCHEMA changes the defaults for subsequent definitions in the same SQL file.

Comprehensive API Reference

MANDATORY: Before implementing, editing, or suggesting feature code, read its linked skill and these required companion skills:

  • Auto Loader, Auto CDC, sinks → also read the streaming-table skill: Auto Loader/CDC target streaming tables; sinks use streaming append flows.
  • Auto Loader → also read the matching format options references/auto-loader-options-{csv,json,avro,parquet,xml,text,orc}.md. For schema inference/evolution, hints, rescued data, partition inference or type widening, read schema.
  • Expectations → also read the target dataset's definition skill for constraint placement.
  • Kafka / Event Hubs sources → also read authentication: Python or SQL (SASL, MSK IAM, Entra ID, GCP OAuth; shaded class names required).
    • Confluent Schema Registry Avro → read Kafka deserialization, Python only. For SQL pipelines, explain the limitation and recommend switching to Python.
    • JSON/Avro without Schema Registry, or Protobuf → Python or SQL, matching the pipeline language.
  • Real-Time Mode → read reference. Only for explicitly requested operational sub-second latency; requires continuous mode + a real-time update flow.

Feature references

Feature Python SQL
Streaming tables; explicit targets; append and one-time backfill flows; skip upstream change commits Python SQL
Materialized views; manual/auto liquid clustering, partitioning, table properties, explicit schemas, generated columns, row filters and column masks (Public Preview), private datasets Python SQL
Temporary views Python SQL
Persistent UC views Unsupported SQL
Delta/Kafka/Event Hubs/custom sinks Python Unsupported
ForEachBatch sinks Python Unsupported
Auto CDC from a stream Python SQL
Auto CDC from periodic snapshots Python SQL
Expectations: warn, drop, fail; individual or multiple constraints Python SQL
Auto Loader Python SQL
Kafka/Event Hubs sources Python SQL
Kinesis sources Python SQL
Payload deserialization (JSON/Avro/Protobuf) Python SQL
  • REPLACE WHERE: overwrite a bounded window/partition each run, such as a rolling lookback. Read Python or SQL.
  • REPLACE USING: streaming keyed replacement of full rows with a required sequencing column. Read Python or SQL.

Reads and compatibility

  • Pipeline batch reads: spark.read.table("name") / SELECT ... FROM name; streaming reads: spark.readStream.table("name") / SELECT ... FROM STREAM name.
  • Pub/Sub and Pulsar sources: use spark.readStream.format("pubsub") or spark.readStream.format("pulsar"); SQL uses STREAM read_pubsub(...) or STREAM read_pulsar(...).
  • JDBC/Federation are batch sources; Python uses spark.read.format("postgresql") etc. and SQL references the federation catalog.
  • Static files: spark.read.format(...).load(...) / read_files(...) without STREAM.
  • Custom data sources are Python-only: spark.read[Stream].format("custom").
  • Prefer from pyspark import pipelines as dp for new Python. Preserve existing dlt imports. Prefer spark.read.table / spark.readStream.table over legacy dp.read, dlt.read, and their streaming variants.
  • Never use LIVE. references or legacy CREATE LIVE TABLE / CREATE LIVE VIEW syntax; use current dataset definitions.

Performance

  • Performance tuning - Cluster key selection by layer, streaming state management, and join optimization
  • Making a materialized view with more than 3 joins incremental → decompose-materialized-view-python (Python) or decompose-materialized-view-sql (SQL)

Language-specific guides

  • Before writing Python, first read Python basics: decorators, functions, and critical rules.
  • Before writing SQL, first read SQL basics: statements and critical rules.

Running the pipeline

  • Dry run is a faster way to confirm the correctness of the pipeline code
  • Full refresh is the most expensive and dangerous option and can lead to data loss; use it only when really necessary, and always as a follow-up the user must explicitly select.
  • Terminology: Never say "run a dry run" — the phrase is redundant. Say "do a dry run" or "start a dry run" instead.
  • To perform a rewind pipeline operation, first read rewind-pipeline.
  • To refresh or reset-and-refresh a single flow of a table (rather than the whole table), first read flow-reset-refresh. Resetting a flow cannot be undone; like a full refresh, the user must explicitly select it.

Pipeline Settings

  • To answer questions about or change pipeline settings, read pipeline-settings.md first.
  • Make a pipeline continuous / always-on / "run continuously", or set its maintenance window → do NOT just set continuous: true; read continuous-pipeline.md first, as the mechanism depends on flags and the pipeline's current mode.
  • community-connectors — Build and test a community connector for a SaaS or REST API without an existing connector.
  • file-ingestion-and-processing — Ingest files from volumes, cloud storage, SFTP, Google Drive, SharePoint, or OneDrive and parse documents.
  • migrate-to-sdp — Migrate a dbt or Informatica ETL project to Spark Declarative Pipelines.
  • pipeline-debugging — Diagnose failed, slow, or flaky pipeline updates and materialized-view incrementalization.
  • writing-unit-tests — Write Python unit tests or refactor notebook code into importable, tested modules.

CLI workflows

  • Migration Guide: DLT → SDP
  • Project Initialization with DAB
  • Querying SCD Type 2 Tables
  • Rapid Iteration with CLI (no DAB)

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

More from Databricks

View source →
databricks-data-discoveryDiscover, explore, and query Databricks data via Genie — the CLI equivalent of the Genie One MCP. MUST be invoked whenever the user asks to find or locate data ('what tables are in X', 'where does X live', 'which catalog/schema has Y'),…2 installsspark-python-data-sourceBuild custom Python data sources for Apache Spark using the PySpark DataSource API — batch and streaming readers/writers for external systems. Use this skill whenever someone wants to connect Spark to an external system (database, API,…1 installsdatabricks-python-sdkDatabricks development guidance including Python SDK, Databricks Connect, CLI, and REST API. Use when working with databricks-sdk, databricks-connect, or Databricks APIs.1 installsdatabricks-execution-computeExecute code and manage compute on Databricks: run Python/Scala/SQL/R via serverless, classic, or interactive clusters, and create/resize/delete clusters and SQL warehouses.1 installsdatabricks-setup-localPreviews, provisions, or diagnoses a uv-managed local Python .venv with `databricks environments setup-local`. Use when the user wants to set up or fix one for Databricks Connect, cluster or serverless compute, `--job-task`, or a bundle…1 installsdatabricks-serverless-migration-apiMigrate Databricks jobs to serverless through the Compute Migrations API and CLI, then track, review, and approve each migration. Use for automated job migrations managed by this service, scripts that start and track migrations, requests…0 installs

Frequently asked questions about databricks-pipelines

What does the databricks-pipelines skill do?

Spark Declarative Pipelines (formerly DLT) in Python or SQL: streaming tables, materialized views, expectations, Auto CDC, Auto Loader, and pipeline settings. Also covers continuous mode, run-as, parameters, rewind, views, sinks and ForEachBatch, append flows, pipeline setup, migrating from legacy DLT, cluster keys, streaming state, and dedup or windowed aggregations. Also file ingestion from volumes, cloud storage, SFTP, Google Drive, SharePoint or OneDrive and document parsing; debugging failed, slow, or flaky updates from the update history; migrating dbt or Informatica projects to SDP; authoring community connectors; and Python unit testing and notebook refactoring. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the databricks-pipelines skill?

Run `npx @skills-hub-ai/cli install databricks-pipelines` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/databricks-pipelines/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does databricks-pipelines work with?

databricks-pipelines runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the databricks-pipelines skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use databricks-pipelines after installing it?

In Claude Code, type `/databricks-pipelines` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the databricks-pipelines skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/databricks-pipelines)](https://skills-hub.ai/skills/databricks-pipelines)
HTML
<a href="https://skills-hub.ai/skills/databricks-pipelines"><img src="https://skills-hub.ai/api/badges/skill/databricks-pipelines" alt="Install on Skills Hub"></a>

More options in the badge docs.