What you will be able to do
- Explain which workloads read the offline Delta feature table and which read the published online copy
- Publish a Unity Catalog feature table to a Databricks Online Feature Store with publish_table
- Predict what the online copy holds for time series and non-time-series feature tables
- Check whether a feature table meets the requirements for going online
- Choose between the TRIGGERED, CONTINUOUS and SNAPSHOT publish modes based on staleness and update patterns
- Query and safely delete an online table
Key concept
Publishing an offline feature table — The offline Delta table in Unity Catalog is where features are stored and written. An online table is a copy of it that publish_table creates in a Lakebase-backed online store and keeps in sync, so that real-time serving can look up features with low latency.
1.Two copies of the same features, read by different workloads
A Databricks feature table can exist in two forms, and each form serves different workloads. The offline feature table is a Delta table in Unity Catalog. People search it to discover features, models train on it, and batch scoring reads from it. The online table is a copy published into a Databricks Online Feature Store. That store is built on Lakebase and returns individual feature values with low latency, even at high request volumes. The offline table stays the source of truth. The online table holds only what was published to it.
How a model is scored decides which copy it reads. The full comparison is in Batch vs streaming vs real-time inference. What matters here is the read path. Batch and streaming scoring read the offline Delta tables and join the feature values to the new data before scoring. Real-time serving reads the online store. When a model logged with the Feature Engineering client runs behind a Model Serving endpoint, the endpoint takes the entity IDs from each request and looks up precomputed features in the online store. The caller sends only the primary key, such as user_id.
| Aspect | Offline feature table | Online table |
|---|---|---|
| Storage | Delta table in Unity Catalog | Databricks Online Feature Store, powered by Lakebase |
| Readers | Feature discovery, model training, batch inference | Model Serving automatic feature lookup, Feature Serving endpoints |
| How data arrives | Feature computation code writes to it, as a batch or a stream | Synced from the offline table by publish_table |
| Governance | Unity Catalog table with a primary key | Also a Unity Catalog entity, with lineage tracked back to the source table |
Real-time workloads need the online copy because their features have to arrive within the request. Recommendation systems, fraud detection and personalization engines all score a single entity while a user or transaction waits. Reading an analytical Delta table on every request is not what the store is designed for. A training-set API is not a serving path either. If a real-time endpoint cannot get its features fast enough, publish the offline table to an online store.
Two terms from the table need a definition. A FeatureSpec is a Unity Catalog entity that bundles feature lookups and feature functions into one reusable unit, usable for model training or for serving. A Feature Serving endpoint returns those features directly to callers outside Databricks, such as an externally hosted model or a rules engine. A Model Serving endpoint instead looks up features itself on behalf of a model logged with the Feature Engineering client. Both follow the same rule: a FeatureSpec always points at the offline tables, and those tables must still be published before they can be served in real time.
Checkpoint 1 of 9· Check yourself
A fraud-detection model was logged with the Feature Engineering client and runs behind a Model Serving endpoint. Each request sends only a transaction's primary key, and the endpoint cannot get its features fast enough. Which change fixes this?
Real-time serving reads from the online store, so the offline table has to be published there. A training-set API, a FeatureSpec on unpublished tables, and direct Delta reads all keep the endpoint on the offline read path.
“For real-time serving use cases, publish the features to an online feature store.”Source: docs.databricks.com
2.Creating an online store and publishing a table to it
You need an online store before you can publish anything to it. create_online_store provisions highly available managed infrastructure as a Lakebase Autoscaling instance. Its capacity is set in Lakebase Compute Units. The feature requires Databricks Runtime 16.4 LTS ML or above, or serverless compute, plus databricks-feature-engineering>=0.13.0 installed in the notebook. A store keeps running until you delete it, so delete development and test stores when nobody is using them, to control cost.
from databricks.feature_engineering import FeatureEngineeringClient
# Initialize the client
fe = FeatureEngineeringClient()
# Create an online store with specified capacity
fe.create_online_store(
name="my-online-store", # maximum of 63 bytes
capacity="CU_2" # Valid options: "CU_1", "CU_2", "CU_4", "CU_8"
)A store holds only the tables published to it. When the store reaches the AVAILABLE state, you publish each feature table that needs low-latency access. Each publish_table call does three things:
- creates the table in the online store if it does not already exist
- syncs the feature data from the offline table into it
- sets up the infrastructure that keeps the online table in sync with the offline table
Read replicas and extra capacity change how the store performs, but they do not add any table to it. A table only becomes available for lookups once it has been published.
from databricks.ml_features.entities.online_store import DatabricksOnlineStore
# Get the online store instance
# For Lakebase Autoscaling projects creating using the Lakebase API or UI,
# `name` is the last part of the resouce name: projects/{online_store_name}
online_store = fe.get_online_store(name="my-online-store")
# Publish the feature table to the online store
fe.publish_table(
online_store=online_store,
source_table_name="catalog_name.schema_name.feature_table_name",
# for online_table_name, the catalog name, schema name, and table name each are limited to a maximum of 63 bytes
online_table_name="catalog_name.schema_name.online_feature_table_name",
# `publish_mode` argument is optional and defaults to "TRIGGERED" mode if not specified
)Publishing does not need to happen before training. You can publish a feature table at any point before the model is deployed, including after the model has been trained. The model records which features it was trained on. At serving time the endpoint uses Unity Catalog to find those features in the online store, so the training code does not change when the features go online.
Checkpoint 2 of 9· Fill the gap
Your store has reached the AVAILABLE state, and you now need the offline feature table copied into it and kept in sync for low-latency lookups. Which method completes this sample?
from databricks.ml_features.entities.online_store import DatabricksOnlineStore
# Get the online store instance
# For Lakebase Autoscaling projects creating using the Lakebase API or UI,
# `name` is the last part of the resouce name: projects/{online_store_name}
online_store = fe.get_online_store(name="my-online-store")
# Publish the feature table to the online store
fe. ? (
online_store=online_store,
source_table_name="catalog_name.schema_name.feature_table_name",
# for online_table_name, the catalog name, schema name, and table name each are limited to a maximum of 63 bytes
online_table_name="catalog_name.schema_name.online_feature_table_name",
# `publish_mode` argument is optional and defaults to "TRIGGERED" mode if not specified
)publish_table creates the online table if it does not exist, syncs data from the offline source table, and sets up the infrastructure that keeps it in sync. write_table only writes to the offline Delta table. create_online_store provisions the store but adds no tables to it. create_training_set builds offline training data.
Source: docs.databricks.comCheckpoint 3 of 9· Exam question
A fraud-detection model is deployed to a real-time Model Serving endpoint that must score incoming transactions within tens of milliseconds. The engineering team has an existing offline feature table in Unity Catalog that holds the customer-level features the model needs, but the endpoint currently cannot retrieve those features fast enough at inference time. What should the team do to give the endpoint low-latency access to these features?
Correct answer: B — Publish the offline feature table to an online store with fe.publish_table so the endpoint performs low-latency lookups against the Lakebase-backed online copy.
- A.
create_training_setbuilds a point-in-time training dataset for model development, not a low-latency lookup path for a live serving endpoint, so it does not solve the latency problem here. - B. Publishing the feature table to an online store syncs it to Lakebase-backed infrastructure purpose-built for high-throughput, low-latency point lookups, which is exactly what a real-time endpoint needs.
- C. Read replicas improve throughput and availability for a table already present in an online store, but they do not make an unpublished offline table reachable from that store.
- D. Offline Delta tables are optimized for large scan-oriented batch and analytical workloads, not the sub-millisecond point lookups a real-time endpoint requires.
3.What the online copy keeps, and why training stays offline
What the online copy holds depends on how the offline table was declared. In a time series feature table, a timestamp column is marked TIMESERIES as part of the primary key. When you publish that table, the online copy keeps only the latest value for each key, because older rows for the same entity are deduplicated during publishing. This is what most model serving and feature serving endpoints need: the current state of each customer, card or product.
If the table has no time series designation, every row is published without deduplication. That only makes sense when an endpoint must fetch one specific historical value by entity ID and exact timestamp, for example to back-test predictions against the values that were served at that time. Even then, the lookup is an exact match on a string primary key. It is not a point-in-time (as-of) query and not a range query. To use a DATE or TIMESTAMP column as a plain lookup key, change the column type to STRING.
Point-in-time correctness belongs to the offline side. create_training_set joins feature tables to label rows (training with feature tables covers the API). With time series tables, it performs an as-of join on the timestamp_lookup_key you pass. Each label row then gets the feature values that were current at its own timestamp, so features from after the label's time never leak into training. The online path does the opposite. At scoring time Model Serving fetches the published values, so predictions always use the most recent features. Neither the online snapshot nor the order in which rows arrive during a continuous sync can recreate past feature values for training.
Checkpoint 4 of 9· Check yourself
Each label row for a churn model has its own event timestamp, and the training features must be the values that were known at that moment. The time series feature table is also published to an online store in CONTINUOUS mode. Where should the training job get its features?
Point-in-time correctness comes from the offline side: create_training_set does an as-of join on the timestamp_lookup_key, so each label gets the features that were current at its time. The online copy of a time series table holds only the latest value per key. Even without the time series designation, an online lookup is an exact match on the key, not an as-of query.
“This enables point-in-time lookups when you use create_training_set or score_batch. The system performs an as-of timestamp join, using the timestamp_lookup_key you specify.”Source: docs.databricks.com
Checkpoint 5 of 9· Exam question
A data scientist is assembling a training set for a churn model using several feature tables joined to historical label events, and each label row must be matched to feature values as they existed at that row's timestamp to avoid leaking future information. Which approach correctly builds this training set?
Correct answer: A — Call fe.create_training_set against the offline feature tables with a timestamp lookup key so features are joined as of each label's recorded event time.
- A.
create_training_setagainst the offline feature tables with a timestamp lookup key performs the point-in-time join that matches each label to the feature values valid at that moment, preventing label leakage. - B. An online store only holds the latest materialized values for serving; it is not designed to preserve or expose historical point-in-time state for training joins.
- C. Sync arrival order in a continuously published online store reflects when data was propagated, not the business event timestamp needed for a correct point-in-time join.
- D. The serving endpoint's automatic feature lookup returns the current online value for real-time scoring; it has no mechanism for resolving historical point-in-time training joins.
4.Which tables can be published
Every feature table has to meet the same requirements before publishing, with or without a time series column:
- a primary key constraint
- primary key columns that contain no NULL values
- Change Data Feed enabled on the Delta table, which the TRIGGERED and CONTINUOUS publish modes require
If a table was created without these, you can usually fix it with two ALTER TABLE statements and no rewrite.
-- Enable CDF if not already enabled
ALTER TABLE catalog.schema.your_feature_table
SET TBLPROPERTIES ('delta.enableChangeDataFeed' = 'true');
-- Ensure primary key columns are not nullable
ALTER TABLE catalog.schema.your_feature_table
ALTER COLUMN user_id SET NOT NULL;Some tables can never go online. A feature table based on a view works for offline training and evaluation. It cannot be published to an online store, and neither its features nor models built on them can be served. A team that prototypes on a view and later tries to deploy a real-time endpoint has to materialize those features into a Delta table first.
Data types are the other limit. The Delta table's types must be supported by Feature Engineering in Unity Catalog. Automatic feature lookup in Model Serving supports IntegerType, FloatType, BooleanType, StringType, DoubleType, LongType, TimestampType, DateType, ShortType, ArrayType and MapType. Check the columns against this list before you promise a team real-time serving.
The nullable key. Primary key columns can never contain NULLs, whatever the publish mode. Change Data Feed is only required for TRIGGERED and CONTINUOUS, so a one-time SNAPSHOT does not need it.
Checkpoint 6 of 9· Fill the gap
A team will publish an existing offline feature table in the default TRIGGERED mode, and later in CONTINUOUS mode. Before that, they have to change one table property. Which property name completes the preparation script?
-- Enable CDF if not already enabled
ALTER TABLE catalog.schema.your_feature_table
SET TBLPROPERTIES (' ? ' = 'true');
-- Ensure primary key columns are not nullable
ALTER TABLE catalog.schema.your_feature_table
ALTER COLUMN user_id SET NOT NULL;The TRIGGERED and CONTINUOUS publish modes sync changes from the offline table, so Change Data Feed has to be enabled on that Delta table. Only a one-time SNAPSHOT copy runs without it. The other properties change how Delta stores or writes data and do not meet the publishing requirement.
Source: docs.databricks.com5.Publish modes: TRIGGERED, CONTINUOUS and SNAPSHOT
The publish_mode argument decides how and when the online table picks up changes from the offline table, and so how stale the served features can get. If you leave it out, it defaults to TRIGGERED.
| publish_mode | How the online table updates | Needs Change Data Feed | Best when |
|---|---|---|---|
| TRIGGERED (default) | Applies changes incrementally when publish_table runs, on demand or on a schedule | Yes | Features are refreshed in batches, e.g. a daily job, and that much staleness is acceptable |
| CONTINUOUS | A streaming pipeline updates the online store immediately as new data lands in the offline table | Yes | The offline table changes constantly and endpoints must see changes right away |
| SNAPSHOT | Each sync is a one-time copy of all data from the source table | No | Many existing rows change between two syncs, so a full copy costs less than applying each change |
With TRIGGERED, staleness depends on how often you run it. You can run publish_table from a notebook scheduled as a Lakeflow Job, or schedule updates to the pipeline whose id publish_table returns. Between runs the online table stays at the last sync. Consider a fraud-scoring table that is updated nonstop from a transaction stream. If its TRIGGERED sync runs every few hours, the endpoint scores against values that are hours old. Running the sync less often makes this worse. Switching to SNAPSHOT doesn't help either: it is still a full copy at a single point in time. CONTINUOUS fixes it, because a streaming pipeline sends each change to the online store as it arrives.
SNAPSHOT is a one-time copy per sync, not an ongoing feed. Each sync copies all data from the source table to the online store, and the online table holds that copy until another sync operation runs, so it is only as fresh as the last copy. The mode pays off when a large number of updates land on existing rows between two syncs: one full copy then replaces a long run of row-level changes. It suits tables that are rewritten wholesale and read with a tolerance for staleness, not tables that endpoints need to see change as it happens.
Turning off Change Data Feed to speed up a sync has the opposite effect. Both incremental modes rely on the change feed, so TRIGGERED and CONTINUOUS stop working without it. Older code may pass streaming=True instead of a mode. From v0.13.0 onward, publish_mode replaces that parameter, and streaming=True is treated as publish_mode="CONTINUOUS".
Checkpoint 7 of 9· Match them up
Match each publish_mode value to the feature table situation it suits best.
Tap a term, then the definition that fits it.
TRIGGERED applies changes incrementally on demand or on a schedule. CONTINUOUS runs a streaming pipeline that updates the online store as new data arrives. SNAPSHOT is a one-time full copy that pays off when many rows change, and it is the only mode that runs without Change Data Feed.
“The online table is set up with a streaming pipeline to immediately update the online store as new data written to the offline feature table.”Source: docs.databricks.com
Checkpoint 8 of 9· Exam question
An online store already serves a fraud-scoring endpoint, but the team notices the endpoint keeps scoring against feature values that are several hours stale relative to the offline feature table, which is updated continuously as transactions stream in. Which change to the publish configuration most directly reduces this staleness to a matter of seconds?
Correct answer: C — Switch the publish mode to CONTINUOUS so a streaming pipeline propagates each offline table change to the online store within seconds of it landing.
- A. SNAPSHOT performs a one-time full copy at the moment it runs and does not keep syncing afterward, so it does not reduce ongoing staleness between refreshes.
- B. TRIGGERED mode syncs incrementally on the cadence it is scheduled at; running it nightly reproduces the multi-hour staleness rather than reducing it to seconds.
- C. CONTINUOUS mode runs a streaming pipeline that propagates each change from the offline table to the online store almost immediately, which is what brings staleness down to seconds.
- D. Change Data Feed is what lets the publish job detect incremental changes at all; disabling it removes the mechanism TRIGGERED and CONTINUOUS modes depend on instead of speeding anything up.
Sources2
6.Inspecting and removing an online table
A published online table is a Unity Catalog entity in its own right, and it tracks lineage back to its source table. Once its status is AVAILABLE, you can browse its schema and sample rows in the Unity Catalog UI to confirm the publish worked. For deeper checks you can run PostgreSQL queries against it in the SQL editor, since Lakebase is a Postgres database underneath.
Deleting an online table needs care, because it lives in two places: Unity Catalog and the Lakebase database. Running DROP TABLE in Databricks SQL, or using the SDK call that deletes a synced table, does not remove the data from the underlying database storage. The recommended method, which removes the table from both places, is the Feature Store call in the Databricks SDK:
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
w.feature_store.delete_online_table(online_table_name="catalog_name.schema_name.online_feature_table_name")Model serving and feature serving endpoints look up features at request time, so deleting an online table they use makes them fail without notice. Before you delete one, confirm that no endpoint still reads it. Deleting the online copy does not touch the offline feature table, which still serves training and batch scoring. To remove a whole store, use fe.delete_online_store(name=...).
Checkpoint 9 of 9· Fill the gap
An online table is being retired, and no endpoint reads it any more. Its data must be removed from Unity Catalog and from the Lakebase database too, not just from the catalog. Which method completes this sample?
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
w.feature_store. ? (online_table_name="catalog_name.schema_name.online_feature_table_name")Only w.feature_store.delete_online_table removes the online table from both Unity Catalog and the underlying database. DROP TABLE and the SDK call that deletes a synced table leave the data in database storage. delete_online_store removes the whole store, not one table.
Source: docs.databricks.comPractise it for real
Publish an existing Unity Catalog feature table to a Databricks Online Feature Store, check the result, and clean up.
1.In a notebook on Databricks Runtime 16.4 LTS ML or serverless, install databricks-feature-engineering>=0.13.0, restart Python, and call fe.create_online_store(name="my-online-store", capacity="CU_1").
Why: Tables can only be published into a store that already exists.
You should see: The store is provisioned and, after a while, reaches the AVAILABLE state.
2.Run the two ALTER TABLE statements on your feature table to turn on Change Data Feed and make the primary key column NOT NULL.
Why: Publishing requires non-null primary keys, and the default TRIGGERED mode requires Change Data Feed.
You should see: Both statements succeed and the table keeps its primary key constraint.
3.Call fe.publish_table with online_store, source_table_name and online_table_name, and leave publish_mode unset.
Why: With no mode given, the table is published in TRIGGERED mode.
You should see: The call returns an object that includes a pipeline id you can schedule for incremental updates.
4.Wait for the online table to show AVAILABLE, then open it in the Unity Catalog UI and look at the schema and sample data.
Why: This confirms the sync worked before any endpoint depends on the table.
You should see: The online table appears as a Unity Catalog entity with the published rows. A time series source shows one row per key.
5.Delete the online table with w.feature_store.delete_online_table, then delete the store with fe.delete_online_store(name="my-online-store").
Why: Only the SDK delete removes the table from both Unity Catalog and the database, and an unused development store keeps costing money.
You should see: The online table and the store are both gone. The offline feature table is unchanged.
Stuck? Get a nudge
If publish_table complains about the source table, check that its primary key columns are NOT NULL and that delta.enableChangeDataFeed is set to true.
Sources
(5)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“The offline feature store is used for feature discovery, model training, and batch inference. It contains feature tables materialized as Delta tables.”
↩︎ Two copies of the same features, read by different workloads“In batch inference, feature values are retrieved from the offline store and joined with new data prior to scoring.”
↩︎ Two copies of the same features, read by different workloads“In real-time inference, feature values are retrieved from the online store.”
↩︎ Two copies of the same features, read by different workloads“At inference time, the model serving endpoint automatically uses the entity IDs in the request data to look up pre-computed features from the online store”
↩︎ Two copies of the same features, read by different workloads“A FeatureSpec always references the offline feature tables, but they must be published to an online store for real-time serving scenarios.”
↩︎ Two copies of the same features, read by different workloads“A FeatureSpec is a Unity Catalog entity that defines a reusable set of features and functions for serving.”
↩︎ Two copies of the same features, read by different workloads“This enables point-in-time lookups when you use create_training_set or score_batch. The system performs an as-of timestamp join, using the timestamp_lookup_key you specify.”
↩︎ What the online copy keeps, and why training stays offline“These tables are also Unity Catalog entities that natively track lineage to the source tables.”
↩︎ Inspecting and removing an online table“For real-time serving use cases, publish the features to an online feature store.”
↩︎ Checkpoint - 2.
“Online Feature Stores provide low-latency access to feature data at a high scale”
↩︎ Two copies of the same features, read by different workloads“After your online store is in the AVAILABLE state, you can publish feature tables to make them available for low-latency access.”
↩︎ Creating an online store and publishing a table to it“Databricks Online Feature Stores requires Databricks Runtime 16.4 LTS ML or above. You can also use serverless compute.”
↩︎ Creating an online store and publishing a table to it“To manage costs, delete online stores when not in use for development and testing.”
↩︎ Creating an online store and publishing a table to it“Only the latest feature values for each entity ID are available in the online store for real-time applications.”
↩︎ What the online copy keeps, and why training stays offline“This is an exact-match lookup on a string primary key, not a point-in-time (as-of) or temporal range query.”
↩︎ What the online copy keeps, and why training stays offline“Non-nullable primary keys: Primary key columns cannot contain NULL values”
↩︎ Which tables can be published“set up with a streaming pipeline to immediately update the online store as new data written to the offline feature table”
↩︎ Publish modes: TRIGGERED, CONTINUOUS and SNAPSHOT“Performs a one-time sync that copies all data from the source table to the online store.”
↩︎ Publish modes: TRIGGERED, CONTINUOUS and SNAPSHOT“This mode is efficient when there are large number of updates on existing rows between two sync operations.”
↩︎ Publish modes: TRIGGERED, CONTINUOUS and SNAPSHOT“Incrementally updates the online table with changes from the offline table using the API or on a schedule.”
↩︎ Publish modes: TRIGGERED, CONTINUOUS and SNAPSHOT“For backward compatibility, if streaming=True is passed, it is equivalent to setting publish_mode="CONTINUOUS".”
↩︎ Publish modes: TRIGGERED, CONTINUOUS and SNAPSHOT“you can use the SQL editor to run PostgreSQL queries against your online feature tables”
↩︎ Inspecting and removing an online table“This is the only recommended method for deleting an online table. It removes the the table from both Unity Catalog and the database.”
↩︎ Inspecting and removing an online table“Before you delete a table, you should ensure that its online features are no longer used by model serving or feature serving endpoints.”
↩︎ Inspecting and removing an online table“The publish_table API synchronizes data from your offline feature table to online store created using create_online_store API.”
↩︎ Key concept“Only the latest feature values for each entity ID are available in the online store for real-time applications.”
↩︎ Exam trap 1“Change Data Feed enabled: Required for the CONTINUOUS and TRIGGERED publish modes.”
↩︎ Exam trap 2“do not delete the table from underlying database storage”
↩︎ Exam trap 4“will be deduplicated in the publish pipeline”
↩︎ Prediction“Change Data Feed enabled: Required for the CONTINUOUS and TRIGGERED publish modes.”
↩︎ Prediction“The online table is set up with a streaming pipeline to immediately update the online store as new data written to the offline feature table.”
↩︎ Checkpoint - 3.
“Feature serving endpoints are best when you consume features outside of Databricks, such as in an externally hosted model or a rules engine.”
↩︎ Two copies of the same features, read by different workloads“In this way, the most recent feature values are always used for predictions.”
↩︎ What the online copy keeps, and why training stays offline - 4.https://docs.databricks.com/aws/en/machine-learning/feature-store/automatic-feature-lookupOfficial docs
“You can publish the feature table at any time prior to model deployment, including after model training.”
↩︎ Creating an online store and publishing a table to it“Automatic feature lookup is supported for the following data types:”
↩︎ Which tables can be published - 5.
“Feature tables based on views can be used for offline model training and evaluation. They cannot be published to online stores.”
↩︎ Which tables can be published“Verify the data type in the Delta table is supported by Feature Engineering in Unity Catalog.”
↩︎ Which tables can be published“Feature tables based on views can be used for offline model training and evaluation. They cannot be published to online stores.”
↩︎ Exam trap 3