Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Data Engineer Professional

Lakeflow pipelines and Auto Loader

Databricks Data Engineer Professional · Lesson 4 of 21 · 32:55

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Data Engineer Professional exam. In this lesson: Lakeflow Spark Declarative Pipelines and their datasets, Auto Loader inside a pipeline, streaming tables versus materialized views, and when to choose Structured Streaming or a pipeline. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Late orders, wrong revenue

Quayside Eats lands order events as JSON files in cloud storage every minute, and finance needs revenue per restaurant and per hour, corrected when late orders arrive. A first version, written as Spark jobs by hand, reprocessed everything each night and still missed late events. This lesson covers Lakeflow pipelines: streaming tables, materialized views, Auto Loader, and when to choose Structured Streaming instead.

Pipelines and datasets

Lakeflow pipelines, formerly Delta Live Tables, extend Apache Spark Declarative Pipelines: you declare the datasets, in SQL or Python, and the pipeline works out the order, the parallelism, the retries, and the checkpoints. A streaming table is a Unity Catalog managed table that receives streaming flows, and processes each new record exactly once, from an append only source. A materialized view is a managed table whose results are recomputed as needed, often incrementally on serverless compute, to match the current state of its sources. A view is computed when it is read, is not stored, and can only be used inside its pipeline. A pipeline runs in triggered mode, which processes the available data and stops, or in continuous mode, which keeps its tables fresh as data arrives.

Auto Loader in a pipeline

Auto Loader ingests new files from cloud storage incrementally and idempotently, and Databricks recommends streaming tables for most ingestion. In SQL, a streaming table selects from stream read_files, with the path and the format, and in Python, a table function returns a stream read with the cloudFiles format. The pipeline manages the checkpoint and the schema location for you, so each file is loaded exactly once, even after a restart. Auto Loader infers the schema and adds new columns as they appear, while unexpected values can be kept in the rescued data column. For data from a message bus, like Kafka, a streaming table in a continuous pipeline gives the lowest latency.

Streaming table or materialized view

Choosing between a streaming table and a materialized view comes down to latency, cost, and refresh. A streaming table fits data that only grows, like events and files, when results must be computed incrementally, with high throughput and low latency. But a streaming table processes each record only once, so if a late update or a delete changes a source row, or a joined dimension changes, rows already written stay as they were. A materialized view fits aggregations and joins, and sources that change through updates and deletes: at each refresh, its results match the current state of the data, even when records arrive late or out of order. Its latency is seconds or minutes, not milliseconds, and many readers share its precomputed results. So ingest with streaming tables, and aggregate with materialized views.

Structured Streaming or pipelines

Both run on Spark Structured Streaming, so the question is how much you want to manage yourself. Declarative pipelines manage the orchestration, the checkpoints, the retries, and the data quality expectations, and only Lakeflow pipelines offer AUTO CDC for change data capture. Plain Structured Streaming, in a notebook or a job, gives the most control: foreachBatch for any sink or several writes per batch, custom stateful logic, and real time mode for latency under a second. Pipelines can still write outside Databricks through sinks, like a Kafka topic or an external Delta table. So choose a pipeline for managed ETL with the least code, and Structured Streaming when you need control that a pipeline does not give.

Recap

Let's recap. Lakeflow pipelines declare streaming tables, materialized views, and views, and manage the order, the retries, and the checkpoints for you. Auto Loader, through stream read_files or the cloudFiles format, loads each new file exactly once into a streaming table. Streaming tables fit growing data that needs low latency, but rows already written do not change. Materialized views fit aggregations, joins, and changing sources, and stay correct even with late data. And Structured Streaming with foreachBatch gives more control, when the managed features of a pipeline are not enough.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. In a pipeline, an intermediate query only cleans columns for the next step, and nothing outside the pipeline reads it. The team does not want to store it. Which dataset type fits?

    • A streaming table
    • A materialized view
    • A temporary view
    • A sink to an external Delta table
    Show the answer

    A temporary view

    A view is computed when it is read, is not stored, and only serves the pipeline that defines it. “A streaming table” would store every record in a managed table. “A materialized view” would also store its results, for readers inside and outside the pipeline. And “A sink to an external Delta table” would write the data to an external table, the opposite of what the team wants.

  2. A streaming table joins each new order with the restaurants table, to add the restaurant name. After a restaurant is renamed, its older orders still show the old name. Why?

    • A streaming table processes each row only once
    • The restaurants table needs a watermark
    • The pipeline runs in triggered mode
    • The join needs a broadcast hint
    Show the answer

    A streaming table processes each row only once

    A streaming table processes each row only once, so rows already written keep the name they had, while a materialized view would recompute them. “The restaurants table needs a watermark” would limit the state of a stream, and would not touch rows already written. “The pipeline runs in triggered mode” only decides whether the pipeline stops or keeps running. And “The join needs a broadcast hint” would only change how fast the join runs, not its results.

  3. A team must write each micro-batch of courier positions to two different tables, and call an external API for some rows, with custom logic between the writes. What fits best?

    • A materialized view in a pipeline
    • Structured Streaming with foreachBatch
    • A streaming table with an expectation
    • An AUTO CDC flow
    Show the answer

    Structured Streaming with foreachBatch

    ForeachBatch runs your own code on each micro batch, so it can write to several tables and call an API. “A materialized view in a pipeline” would recompute an aggregate, and cannot run custom writes. “A streaming table with an expectation” would check the data quality of one table, not write to two of them. And “An AUTO CDC flow” applies change data to a target table, and runs no custom logic.