What you will be able to do
- Explain how a Lakeflow pipeline turns declared datasets and flows into a dependency graph it orchestrates, checkpoints and retries for you
- Choose between triggered and continuous pipeline mode, and tell interactive development updates apart from scheduled production runs
- Choose an Auto Loader file discovery mode for a given latency and cost target, including when to set cloudFiles.useNotifications
- Pick the cloudFiles.schemaEvolutionMode that matches a schema-change policy, and explain what the rescued data column captures
- Harden an Auto Loader pipeline for production with monitoring, source retention and an unattended run identity
Key concept
Declarative pipeline graph — In a Lakeflow pipeline you declare what each dataset should contain, not when to compute it. The pipeline works out the dependencies between datasets, runs them in order, and handles checkpoints, retries and compute itself.
1.Datasets, flows and the pipeline graph
A Lakeflow pipeline is made of source files that declare datasets, plus a configuration that says how and where the pipeline runs. The pipeline itself is built on Apache Spark Declarative Pipelines (SDP). You never write the orchestration code. On every update the pipeline starts a cluster, analyses all source files, builds the dependency graph, and then computes or incrementally updates each dataset in dependency order. Upstream datasets are always computed before the ones that read from them. The graph is built from every file in the pipeline, so files can be organised in any order, and one pipeline can mix Python files and SQL files as long as each file uses one language.
The unit of work inside that graph is the flow. A flow reads from a source, applies your logic and writes to a target. Streaming tables receive streaming flows (Append, or AUTO CDC for change feeds), and materialized views receive batch flows. You can declare a flow implicitly inside a streaming table definition, or separately so that several flows append to the same table. Ingestion usually lands in a streaming table, because a streaming table processes each record from an append-only source exactly once.
| Dataset type | How records are processed | Typical use |
|---|---|---|
| Streaming table | Each record processed exactly once, assuming an append-only source | Ingestion and incremental processing of continuously growing data |
| Materialized view | Results recomputed as needed to reflect the current state of the data | Transformations, aggregations, results shared by many downstream consumers |
| View | Evaluated on demand, not persisted | Intermediate transformations and checks inside the same pipeline |
Managed state and recovery come with the declarative model. Streaming tables use checkpoint management that you never configure, and transient failures are retried in widening scopes: first the Spark task, then the flow, then the whole pipeline. A streaming table is owned by one pipeline, and no other pipeline can update it.
Exactly-once processing has a consequence that catches people out. A row already appended to a streaming table is never re-queried. If you change a query from LOWER(name) to UPPER(name), only new rows come out uppercase. To rewrite the existing rows you have to run a full refresh. For which dataset type fits a given latency and cost target, see streaming tables vs materialized views.
Checkpoint 1 of 9· Check yourself
A streaming table in a triggered Lakeflow pipeline has already ingested 10 million rows from Auto Loader. You edit its query to wrap the email column in sha2() so it gets masked. What happens on the next update, and what gets every row masked?
A streaming table processes each record exactly once, so rows it has already appended are never queried again. Only new rows get the new logic, and a full refresh reprocesses the old ones. A second pipeline cannot fix them either, because a streaming table is owned by one pipeline and no other pipeline can update it.
“To reprocess existing rows that were processed prior to the change, a full refresh is required.”Source: docs.databricks.com
2.Triggered vs continuous, development vs production
Pipeline mode decides when an update stops, and it is separate from whether a dataset is streaming. In triggered mode an update refreshes every table using the data that existed when the update started, then shuts down. In continuous mode the pipeline keeps running until someone stops it, processing new data as it arrives. Continuous pipelines avoid wasted work by updating only when the Delta tables they depend on have changed. Both streaming tables and materialized views can run in either mode.
Triggered is the right default for most pipelines. Continuous mode needs a cluster that never shuts down, so keep it for genuine sub-minute latency requirements. For operational workloads that need sub-second end-to-end latency, a pipeline can also run in real-time mode.
Development runs and production runs behave differently. Updates you start interactively from the Lakeflow Pipelines Editor reuse the cluster and turn off automatic retries, so a broken query fails quickly while you iterate. A production pipeline should not depend on someone clicking Start. It should be scheduled by the job scheduler or a Lakeflow Job, which is where unattended runs get the managed retry and recovery behaviour.
| Question | Triggered | Continuous |
|---|---|---|
| When does the update stop? | Automatically when complete | Runs until manually stopped |
| What data is processed? | Data available when the update starts | New data as it arrives in sources |
| Compute | Released after each update | Always-on cluster |
| When it wins | Default for the vast majority of pipelines | Genuine sub-minute latency needs |
Checkpoint 2 of 9· Check yourself
An engineer built an Auto Loader ingestion pipeline and has been running it by clicking Start in the Lakeflow Pipelines Editor each morning. It is now going to run unattended in production. What should change?
A production pipeline should not depend on someone clicking Start. It should run on a schedule from the job scheduler or a Lakeflow Job. Pipeline mode is a separate decision: triggered stays the default, and continuous mode keeps a cluster running, so it only pays off for sub-minute latency.
“The pipeline is scheduled through the job scheduler or a Lakeflow Job rather than someone remembering to select Start.”Source: docs.databricks.com
3.Auto Loader and file discovery
Auto Loader is the Structured Streaming source cloudFiles. You give it a directory in S3, ADLS, GCS or a Unity Catalog volume, and it processes new files as they arrive, optionally including the files already there. It reads JSON, CSV, XML, Parquet, Avro, ORC, text and binary files. Every file it discovers is recorded in a RocksDB key-value store in the checkpoint, which is how it guarantees exactly-once processing and resumes where it stopped after a failure. Inside a Lakeflow pipeline you do not set a schema location or checkpoint location, because the pipeline manages both.
CREATE OR REFRESH STREAMING TABLE raw_events
AS SELECT * FROM STREAM read_files(
's3://my-bucket/landing/',
format => 'json',
cleanSource => 'MOVE',
`cleanSource.moveDestination` => 's3://my-bucket/archive/landing/',
`cleanSource.retentionDuration` => '14 days'
);Auto Loader can find new files in two ways, and the choice is mostly about cost. Directory listing is the default. It calls the storage LIST API, and a continuous trigger such as Trigger.ProcessingTime is expensive in this mode because Auto Loader keeps listing the entire directory. File notification mode subscribes to storage events and skips listing entirely. On AWS, when cloudFiles.useNotifications is true and Auto Loader is allowed to create the resources, it sets up the SNS and SQS services itself. For a stream whose files land unpredictably across many prefixes, this is the change that removes the billed LIST calls while staying near real time.
| Mode | How files are found | When it wins |
|---|---|---|
| Directory listing (default) | Lists the source directory with native cloud APIs | No notification permissions available; triggered or low-frequency runs |
| File events | Notification-based, one queue per bucket, incremental discovery on later runs | Recommended for most workloads: low latency and simple setup |
| Classic file notification (cloudFiles.useNotifications) | Reads directly from the cloud queue, without the caching hop that file events adds | Very latency-sensitive applications; resources can be tagged for cost tracking |
Running the same listing source with Trigger.AvailableNow reduces compute cost because the job runs as a scheduled batch instead of an always-on stream. Each run still lists the directory. If you must stay on directory listing, cloudFiles.cleanSource keeps the directory small by moving (MOVE) or deleting (DELETE) files after processing, so fewer files are listed. This option really does move or delete your source files, and a MOVE destination must be in the same external location, volume or mount as the source.
Checkpoint 3 of 9· Fill the gap
Processed landing files must be kept in an archive path for auditing, and the directory Auto Loader lists must stay small. Which value completes this pipeline definition?
CREATE OR REFRESH STREAMING TABLE raw_events
AS SELECT * FROM STREAM read_files(
's3://my-bucket/landing/',
format => 'json',
cleanSource => ' ? ',
`cleanSource.moveDestination` => 's3://my-bucket/archive/landing/',
`cleanSource.retentionDuration` => '14 days'
);cleanSource MOVE moves processed files to the moveDestination, so they are kept for auditing and fewer files are left to list. DELETE would also shrink the directory, but it removes the files instead of keeping them.
Source: docs.databricks.comCheckpoint 4 of 9· Check yourself
Files for a near-real-time Auto Loader stream land unpredictably across thousands of prefixes. The stream uses directory listing with Trigger.ProcessingTime, and the storage bill is dominated by LIST calls. Which change removes that cost while keeping latency low?
File notification mode subscribes to storage events and skips listing entirely, so it stays near real time without LIST calls. AvailableNow lowers compute cost but still lists the directory on every run, and cleanSource only makes the listing smaller.
“Auto Loader's file notification mode can help reduce your cloud costs further by avoiding directory listing altogether.”Source: docs.databricks.com
Checkpoint 5 of 9· Exam question
A streaming Auto Loader job reads Parquet files landing in an S3 bucket at roughly 200 files per hour, scattered unpredictably across many prefixes. Continuous directory listing is generating a large volume of billed S3 LIST calls, and the team has granted Databricks permission to create the AWS SNS and SQS resources needed for cloud storage notifications. Which configuration change reduces file discovery cost while keeping the stream close to real time?
Correct answer: A — Set cloudFiles.useNotifications to true so Auto Loader subscribes to cloud storage events and only processes files that a notification identifies, instead of repeatedly listing the bucket.
- A. Enabling notification mode makes Auto Loader consume cloud storage events from the SNS/SQS resources it provisions instead of polling the bucket, which cuts
LISTcalls sharply for files scattered across many prefixes while keeping discovery near real time. - B. This still relies on directory listing, so the total number of
LISTcalls against the bucket is unchanged; it only changes how many files each micro-batch pulls per listing, not the discovery cost itself. - C. Skipping existing files on restart only affects the initial backfill and does not stop the ongoing directory listing that discovers each new hour's files, so the recurring
LISTcost remains. - D.
Trigger.AvailableNowchanges how often the stream runs, not the discovery mechanism, and directory listing still issues freshLISTcalls against the bucket on each run rather than reusing a cached listing.
4.Schema inference, evolution and rescued data
Auto Loader infers the schema, stores it in the schema location, and watches for drift. When a type conflicts across Parquet files, it picks the widest type, and schema hints can override that choice. Values that do not match the expected type go into the rescued data column rather than being dropped. This is how Auto Loader keeps data that would otherwise be ignored or lost.
The cloudFiles.schemaEvolutionMode option decides what a new column does to the stream. The default, addNewColumns, merges the new columns onto the end of the stored schema and then stops the stream deliberately. The restart picks up the wider schema, and existing columns never change type. Because that stop is expected, run these streams under Lakeflow Jobs with automatic restart. The other modes each match a different policy.
| Mode | Behaviour on a new column | Use it when |
|---|---|---|
| addNewColumns (default) | Schema updated, stream fails with UnknownFieldException, restart resumes with the new schema | New fields should flow through after an automatic restart |
| failOnNewColumns | Stream fails and the schema is not updated, so it stays down until someone changes the schema or removes the file | A human must review every schema change before more rows are written |
| rescue | Schema never evolves and the stream does not fail; new columns land in the rescued data column | Uptime matters more than promoting new fields to columns |
| none | Schema does not evolve, new columns are ignored, and nothing is rescued unless a rescued data column is configured | The schema is fixed and extra fields are noise |
addNewColumns has already written the new column into the schema before it stops, and the next restart, often automatic, ingests the new field with no review. failOnNewColumns leaves the schema alone, so nothing moves until someone acts.
Checkpoint 6 of 9· Check yourself
In some incoming records, the amount field holds a value that does not match the type Auto Loader inferred and stored for that column. What does Auto Loader do with that value?
Auto Loader sends values that do not match the expected type to the rescued data column instead of dropping them. Under addNewColumns, the restart after UnknownFieldException is triggered by a new column, and existing columns never change type.
“Auto Loader can detect schema drifts, notify you when schema changes happen, and rescue data that would have been otherwise ignored or lost.”Source: docs.databricks.com
Checkpoint 7 of 9· Exam question
A production Auto Loader stream ingests JSON files into a bronze Delta table. Compliance requires that if the upstream system starts emitting a new column, the pipeline must stop immediately so an engineer can review the schema change before any further rows are written, rather than silently ingesting rows that contain the new field. Which cloudFiles.schemaEvolutionMode setting satisfies this requirement?
Correct answer: C — failOnNewColumns
- A.
addNewColumnsupdates the schema automatically and lets the stream continue processing with the new column included, which is the opposite of halting for review. - B.
rescuekeeps the existing schema and routes any new or mismatched fields into a_rescued_datacolumn while the stream keeps running, so it does not stop the pipeline. - C.
failOnNewColumnsstops the stream with an error as soon as a column not present in the known schema is detected, requiring a manual restart after the schema is reviewed, which matches the requirement. - D.
nonedisables schema evolution handling and ignores new columns instead of stopping the stream for them, so it does not enforce a review step.
5.Running it unattended
A production-ready pipeline runs on a schedule against real data and catches its own failures, instead of hearing about them from a downstream consumer. For Auto Loader, monitoring starts with the stream's own state. The cloud_files_state function lists the files a stream has discovered, given its checkpoint location. Each batch also reports backlog metrics to the Streaming Query Listener.
{
"sources": [
{
"description": "CloudFilesSource[/path/to/source]",
"metrics": {
"numFilesOutstanding": "238",
"numBytesOutstanding": "163939124006"
}
}
]
}If numFilesOutstanding keeps growing from one batch to the next, ingestion is falling behind arrivals. In file notification mode on AWS and Azure the metrics also include approximateQueueSize, the approximate number of file events waiting in the cloud queue.
Several production habits come from how the pipeline recovers:
- Let Spark errors surface. A broad
try/exceptthat catchesAnalysisExceptionhides real failures from the event log and interferes with managed retry and recovery. - Run the pipeline as a service principal, not a personal identity.
- Deploy it from a bundle with separate dev and prod targets, and parameterise source paths and catalog names.
- Test what a checkpoint failure looks like before you meet one in an incident.
Some sources change rows rather than only adding them. For those, apply the changes to a streaming table with an AUTO CDC flow instead of appending. AUTO CDC handles out-of-order events and supports SCD Type 1 and Type 2. Because Auto Loader does not order files, a pipeline combining Auto Loader and AUTO CDC should set pipelines.cdc.tombstoneGCThresholdInSeconds above the longest expected arrival delay. The default retention is two days. The full CDC semantics are taught in AUTO CDC and SCD types.
Checkpoint 8 of 9· Fill the gap
You are setting up an alert for an Auto Loader stream that uses directory listing. It should fire when the number of discovered files still waiting to be ingested keeps rising from batch to batch. Which metric name completes the progress report the alert reads?
{
"sources": [
{
"description": "CloudFilesSource[/path/to/source]",
"metrics": {
" ? ": "238",
"numBytesOutstanding": "163939124006"
}
}
]
}numFilesOutstanding is the number of files in the backlog. If it keeps growing from one batch to the next, ingestion is falling behind. approximateQueueSize is only reported in file notification mode, and it counts file events in the cloud queue, not backlog files.
Source: docs.databricks.comCheckpoint 9 of 9· Exam question
A team builds a Lakeflow Declarative Pipelines flow that applies change-data-capture records from a bronze_customers_cdc streaming table into a silver_customers streaming table and must retain full history of every attribute change per customer:
CREATE OR REFRESH STREAMING TABLE silver_customers;
AUTO CDC INTO silver_customers
FROM STREAM bronze_customers_cdc
KEYS (customer_id)
APPLY AS DELETE WHEN operation = "DELETE"
SEQUENCE BY sequence_num
STORED AS SCD TYPE 2;
Which statements about this configuration are correct?(Select 2)
Correct answers: A, B — silver_customers will contain multiple rows per customer_id, each representing a distinct historical version of that customer's attributes over time.; If silver_customers's schema is pre-defined rather than inferred, it must include __START_AT and __END_AT columns typed to match the sequence_num column in SEQUENCE BY.
- A. SCD Type 2 storage preserves history by keeping one row per version of a customer's attributes rather than overwriting the previous row, so the target table grows a new row for each tracked change.
- B. When the target schema is defined ahead of time, AUTO CDC requires
__START_ATand__END_ATcolumns typed to match the sequencing column so it can record each version's validity window correctly. - C. Under SCD Type 2, a delete event closes out the current row's validity window by setting
__END_ATrather than purging the row, so the customer's prior history including the delete remains queryable. - D. AUTO CDC uses the sequence column to reconstruct the correct chronological order of events and update history accordingly; it does not simply throw away events that happen to arrive late.
- E.
KEYSandSEQUENCE BYare required clauses that must be specified explicitly in everyAUTO CDC INTOstatement regardless of the storage mode; they are never inferred from source metadata. - F.
AUTO CDC INTOreads from any streaming table exposed to the pipeline, and that streaming table's own ingestion flow can originate from Kafka or another message bus, not only from Delta storage.
Sources
(9)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Pipelines automatically infer dependencies between datasets and arrange them in a directed acyclic graph (DAG).”
↩︎ Datasets, flows and the pipeline graph“Updates you trigger interactively from the editor optimize for fast iteration, reusing the cluster and disabling automatic retries.”
↩︎ Triggered vs continuous, development vs production“Pipelines automatically infer dependencies between datasets and arrange them in a directed acyclic graph (DAG).”
↩︎ Key concept - 2.https://docs.databricks.com/aws/en/ldp/conceptsOfficial docs
“A flow reads data from a source, applies user-defined processing logic, and writes the result into a target.”
↩︎ Datasets, flows and the pipeline graph“retry transient failures progressively: from the Spark task, to the flow, to the entire pipeline.”
↩︎ Datasets, flows and the pipeline graph“handles out of order CDC events and supports both SCD Type 1 and SCD Type 2”
↩︎ Running it unattended - 3.
“A row that has already been appended to a streaming table will not be re-queried with later updates to the pipeline.”
↩︎ Datasets, flows and the pipeline graph“use AUTO CDC to apply those changes to a streaming table instead of appending them.”
↩︎ Running it unattended“A row that has already been appended to a streaming table will not be re-queried with later updates to the pipeline.”
↩︎ Exam trap 3“To reprocess existing rows that were processed prior to the change, a full refresh is required.”
↩︎ Checkpoint - 4.
“If the pipeline uses triggered mode, the system stops after refreshing all tables based on the data available when the update started.”
↩︎ Triggered vs continuous, development vs production“Pipeline mode is independent of the type of table being computed.”
↩︎ Prediction - 5.
“Reserve continuous for genuine sub-minute latency needs, since it requires an always-on cluster.”
↩︎ Triggered vs continuous, development vs production“The pipeline is scheduled through the job scheduler or a Lakeflow Job rather than someone remembering to select Start.”
↩︎ Triggered vs continuous, development vs production“you don't wrap transformations in broad try/except blocks that catch AnalysisException or other internal Spark exceptions.”
↩︎ Running it unattended“The pipeline runs as a service principal, not a personal user identity”
↩︎ Running it unattended“The pipeline is defined and deployed through a bundle, not hand-clicked into existence in the UI”
↩︎ Running it unattended“Reserve continuous for genuine sub-minute latency needs, since it requires an always-on cluster.”
↩︎ Exam trap 4 - 6.
“As files are discovered, their metadata is persisted in a scalable key-value store (RocksDB) in the checkpoint location of your Auto Loader pipeline.”
↩︎ Auto Loader and file discovery“You do not need to provide a schema or checkpoint location because Lakeflow pipelines automatically manage these settings for your pipelines.”
↩︎ Auto Loader and file discovery“By default, Auto Loader uses directory listing mode. However, Databricks recommends file notification mode using file events for most workloads.”
↩︎ Auto Loader and file discovery“Auto Loader does not guarantee the order in which files are discovered or processed”
↩︎ Auto Loader and file discovery“rescue data that would have been otherwise ignored or lost”
↩︎ Schema inference, evolution and rescued data“Auto Loader's file notification mode can help reduce your cloud costs further by avoiding directory listing altogether.”
↩︎ Exam trap 2“Auto Loader's file notification mode can help reduce your cloud costs further by avoiding directory listing altogether.”
↩︎ Checkpoint“Auto Loader can detect schema drifts, notify you when schema changes happen, and rescue data that would have been otherwise ignored or lost.”
↩︎ Checkpoint - 7.https://docs.databricks.com/aws/en/ingestion/cloud-object-storage/auto-loader/productionOfficial docs
“Continuous triggers such as Trigger.ProcessingTime are especially expensive in directory listing mode, since Auto Loader continuously lists the entire directory to find new files.”
↩︎ Auto Loader and file discovery“File events requires only one queue per bucket and uses incremental discovery on subsequent runs.”
↩︎ Auto Loader and file discovery“Classic mode reads directly from the cloud queue without the additional caching hop introduced by file events.”
↩︎ Auto Loader and file discovery“Setting cloudFiles.cleanSource deletes or moves files in the source directory.”
↩︎ Auto Loader and file discovery“Query cloud_files_state, providing the checkpoint location associated with an Auto Loader stream.”
↩︎ Running it unattended - 8.https://docs.databricks.com/aws/en/spark/api-optionsOfficial docs
“only if you choose cloudFiles.useNotifications = true and you want Auto Loader to set up the notification services for you”
↩︎ Auto Loader and file discovery - 9.
“In the case of a mismatch, Auto Loader rescues the column by placing the data in the rescued data column.”
↩︎ Schema inference, evolution and rescued data“When Auto Loader detects a new column, the stream stops with an UnknownFieldException.”
↩︎ Schema inference, evolution and rescued data“Restarting the stream resumes processing with the updated schema.”
↩︎ Schema inference, evolution and rescued data“Restarting the stream resumes processing with the updated schema.”
↩︎ Exam trap 1