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.
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 instructionsInstall 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.
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 ast. 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 TABLEis Beta with prerequisites. - Resizing an existing stateful flow: Set
spark.sql.streaming.stateStore.partitions(notspark.sql.shuffle.partitions); no full refresh. See streaming-table-python. - SQL parameters (DBR 17.0+): Read parameters-sql before writing. Use
:namefor values that vary across updates, not hardcoding or legacy${name}. Values areSTRING: cast at use; identifiers needIDENTIFIER(). - 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.tablepublishes 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 SCHEMAchanges 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")orspark.readStream.format("pulsar"); SQL usesSTREAM read_pubsub(...)orSTREAM 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(...)withoutSTREAM. - Custom data sources are Python-only:
spark.read[Stream].format("custom"). - Prefer
from pyspark import pipelines as dpfor new Python. Preserve existingdltimports. Preferspark.read.table/spark.readStream.tableover legacydp.read,dlt.read, and their streaming variants. - Never use
LIVE.references or legacyCREATE LIVE TABLE/CREATE LIVE VIEWsyntax; 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.
Related skills
- 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- Databricks CoreDatabricks CLI operations and the parent/entry-point skill for Databricks CLI use: authentication, profile selection,…
- Databricks Zerobus IngestPush records from apps, services, devices, or scripts directly into Unity Catalog Delta tables with Zerobus Ingest:…
- Databricks AI RuntimeDatabricks AI Runtime, the `databricks air` CLI commands for submitting and managing GPU training workloads on…
- Databricks AI FunctionsUse Databricks built-in AI Functions (ai_classify, ai_decide, ai_extract, ai_summarize, ai_mask, ai_translate,…
- databricksDatabricks CLI operations: auth, profiles, data exploration, and bundles. Contains up-to-date guidelines for…
- Databricks SandboxDatabricks Sandbox: on-demand serverless compute for running untrusted or agent-generated code and background tasks.…
Security
Reviews (0)
More from Databricks
View source →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.
[](https://skills-hub.ai/skills/databricks-pipelines)<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.