Automated and streaming feature pipelines
Databricks Machine Learning Professional · Lesson 11 of 22 · 1:16:10
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.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Databricks Certified Machine Learning Professional exam. In this lesson: scheduled feature pipelines that refresh feature tables, streaming features with Structured Streaming and checkpoints, and Feature Views. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Stale numbers
Pebblecove's host statistics are rebuilt by hand in a notebook every few weeks, so the models often train on stale numbers. Meanwhile, the price advice should react to demand within minutes, using the searches that guests are making right now. This lesson covers automated feature pipelines in jobs, streaming features, and Feature Views, where Databricks runs the pipelines for you.
Scheduled feature pipelines
An automated feature pipeline turns the feature computation into code that runs without anyone: a function that reads the source tables, and returns a DataFrame of features, keyed by the primary key. A job runs it on a schedule, or when its source table changes, as a task of Lakeflow Jobs. The task writes with write_table in merge mode, the default, which updates the rows whose keys exist, adds the new keys, and can add new feature columns, so each run is an upsert. In a time series table, each run adds rows with new timestamps, and the history stays point in time correct. And a later task of the same job can publish the table to the online store, so serving sees the fresh values.
Streaming features
Some features must be fresh within minutes, like the number of searches for a home in the last fifteen minutes. Streaming feature engineering reads events with Structured Streaming, from a source like Kafka or a Delta table, and computes aggregates over time windows, with a watermark to bound late events. write_table accepts the streaming DataFrame directly, and starts a stream that merges each micro batch into the feature table, with a checkpoint location to resume where it stopped, and a trigger, every five seconds by default. To reach the models in real time, the table is then published to the online store in continuous mode, which streams every change within seconds. Change data feed must be enabled on the source table, since triggered and continuous publishing read it.
Feature Views
Feature Views take the pipeline work off your hands. You define a feature declaratively with create_feature: its source, like a Delta table or a Kafka stream, its entity, its time column, and a function, like a count over a window. Then materialize_features tells Databricks to compute and store it, offline or online, with a trigger: a cron schedule, a table trigger that runs when the source Delta table changes, or streaming mode for a Kafka source, whose features go to the online store only. At training time, the feature engineering client generates point in time correct training sets from these definitions. Databricks recommends Feature Views for new use cases, while feature tables that your own jobs write remain fully supported.
Recap
Let's recap. An automated pipeline is a feature function run by a job, on a schedule or when its source table changes. write_table in merge mode upserts by primary key, so each run refreshes the table. A streaming DataFrame passed to write_table starts a stream, with a checkpoint location and a trigger, and window aggregates keep the features fresh. Continuous publishing carries those changes to the online store within seconds. And Feature Views define features declaratively, and Databricks materializes them with a cron, table, or streaming trigger.
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.
A nightly job recomputes every host's statistics and writes them with write_table in merge mode. What happens to the row of a host already in the table?
- A duplicate row is appended
- It is updated in place, by its primary key
- The whole table is overwritten
- The write fails on the existing key
Show the answer
It is updated in place, by its primary key
Merge matches the row by its primary key, and refreshes it in place, so each run is an upsert. “A duplicate row is appended” is wrong, since merge does not duplicate existing keys. “The whole table is overwritten” is wrong, since merge only touches the keys in the new data. And “The write fails on the existing key” is wrong, since an existing key is exactly what merge expects.
A streaming feature job is stopped for maintenance, then restarted. What lets it resume from the right place, without processing every event again?
- The trigger interval
- The merge mode of write_table
- The watermark
- The checkpoint location
Show the answer
The checkpoint location
The checkpoint stores the progress of the stream, so a restarted stream resumes after the last processed events. “The trigger interval” only sets how often the micro batches run. “The merge mode of write_table” would decide how rows are written, not where reading resumes. And “The watermark” only bounds how late an event can arrive.
A Feature View counts searches per home from a Kafka stream. Where can materialize_features store it?
- In the online store only
- In the offline store only
- In both stores, in one call
- Nowhere: Kafka needs a feature table
Show the answer
In the online store only
Streaming features from a Kafka source can only be materialized to online stores, with the streaming mode trigger. “In the offline store only” is wrong, since offline storage is not supported for streaming features. “In both stores, in one call” is wrong for the same reason. And “Nowhere: Kafka needs a feature table” is wrong, since Feature Views accept a Kafka source directly.