Autoloader: Declarative Pipelines vs. Structured Streaming
| Aspect | Structured Streaming (manual) | Declarative Pipelines (DLT/Lakeflow) |
|---|---|---|
| Syntax | spark.readStream.format(“cloudFiles”).option(…).load(path) | @dlt.table / CREATE STREAMING TABLE … AS SELECT * FROM cloud_files(…) (SQL) or dlt.read_stream in Python |
| Checkpoint location | You must set checkpointLocation manually in writeStream | Managed automatically by the pipeline (stored under pipeline storage location) |
| Schema location (cloudFiles.schemaLocation) | You set and manage it explicitly | Managed automatically; no manual path needed |
| Schema inference | cloudFiles.inferColumnTypes — you configure | Same option available, but defaults are tuned by the pipeline; less boilerplate |
| Schema evolution | cloudFiles.schemaEvolutionMode (addNewColumns, rescue, failOnNewColumns, none) — handled by your own retry/stream-restart logic on failure | Same modes supported, but pipeline framework handles the stream restart/recovery automatically when schema changes occur |
| Trigger control | Full manual control: trigger(availableNow=True), processingTime, once, continuous | Pipeline-level setting — pipeline runs in Triggered (batch-like, processes available data then stops) or Continuous mode; you don’t set triggers per-table |
| File detection mode | cloudFiles.useNotifications (directory listing vs. event notifications) — you configure | Same underlying options available via pipelines.autoOptimize/cloudFiles options, but less commonly tuned manually since the pipeline optimizes it |
| Rate limiting | cloudFiles.maxFilesPerTrigger, cloudFiles.maxBytesPerTrigger — you set | Same options usable, but pipeline also applies its own backlog/cluster autoscaling to manage throughput |
| Start/stop/orchestration | You call .start(), manage the StreamingQuery object, monitor .status, .lastProgress, handle restarts on failure | Pipeline engine starts/stops/retries streams as part of the DAG; no manual query object management |
| Error handling / retries | You write your own retry logic (e.g., while loop restarting on StreamingQueryException) | Built-in automatic retries and recovery at the pipeline level |
| Data quality checks | Not built-in — you write custom foreachBatch/filter logic | Native @dlt.expect / CONSTRAINT expectations (drop, fail, or just log bad records) |
| Lineage/DAG across tables | Manual — you wire readStream/writeStream between notebooks/jobs yourself | Automatic DAG inferred from table dependencies (bronze → silver → gold) |
| Monitoring/observability | Spark UI, StreamingQueryListener, custom logging | Built-in pipeline event log, data quality metrics, lineage graph in UI |
| CDC / merge patterns | You write foreachBatch + MERGE INTO manually | Native APPLY CHANGES INTO (CDC/SCD Type 1 & 2) with minimal code |
| Flexibility | Highest — full control over Spark session, custom sinks, arbitrary transformations | Lower — constrained to the DLT programming model, but much less operational code |
| Best fit | Custom/complex streaming logic, non-Delta sinks, fine-grained control needed | Standard medallion (Bronze→Silver→Gold) ingestion where you want less boilerplate and built-in reliability |
Autoloader: Declarative Pipelines vs. Structured Streaming
Bottom line: the Autoloader cloudFiles options themselves are largely the same set in both — Declarative Pipelines just wraps checkpointing, schema location, triggering, retries, and orchestration so you don’t configure them by hand.
