What you will be able to do
- Explain what makes a Delta table in Unity Catalog a feature table, and name it with the three-level catalog.schema.table identifier
- Pick FeatureEngineeringClient over the legacy FeatureStoreClient, and install it when the runtime is not an ML runtime
- Create a feature table with Databricks SQL or fe.create_table, including composite primary keys and the df= argument
- Turn an existing Delta table or a Lakeflow pipeline output into a feature table by adding a primary key
- Create a time series feature table with TIMESERIES or timeseries_columns, and say why a timestamp in the primary key is not enough on its own
Key concept
Feature table in Unity Catalog — A Delta table in Unity Catalog that has a primary key constraint. The primary key is the only thing that makes it a feature table. No separate registration step exists, and it does not matter how the table was created.
1.A feature table is a Delta table with a primary key
A feature store lets teams find each other's features and makes sure the code that computes a feature at training time is the same code used at inference. In Unity Catalog the storage behind this is simple. A feature table is a Delta table with a primary key constraint, plus metadata about the sources and the notebooks and jobs that wrote to it. You don't need a special file format or a separate catalog of features.
The primary key is what makes a table a feature table. Suppose retail.features.customer_orders already holds customer_id, order_count and avg_order_value. Once that table has a primary key on customer_id, it counts as a feature table. Later calls to look up its features can then join on that key. Any table managed by Unity Catalog with a primary key also shows up in the Features UI automatically. You don't need to partition by the key, export to Parquet, or register the table through a legacy client first. None of those steps creates a feature table, and the legacy client doesn't manage Unity Catalog tables at all.
A feature table is named like any other Unity Catalog object, with a three-level identifier: <catalog-name>.<schema-name>.<table-name>, for example ml_prod.churn_features.customer_churn. Wherever you create it, in SQL or as the name argument to the Python client, give the full three-level name. A bare table name, a two-level schema.table name, or a DBFS path such as /mnt/features/... does not identify a governed Unity Catalog table.
That three-level name requires a catalog and a schema to exist first, and each comes with a privilege check:
- To create a new catalog for features, you need
CREATE CATALOGon the metastore. - To use an existing catalog, you need
USE CATALOGon it. - Feature tables must live in a schema, and creating one needs
CREATE SCHEMAon the catalog.
The platform must also meet two conditions. Feature Engineering in Unity Catalog needs Databricks Runtime 13.2 or above, and the metastore must be on Privilege Model Version 1.0.
Checkpoint 1 of 9· Check yourself
Your team has an existing Delta table, retail.features.customer_orders, in Unity Catalog. It holds customer_id, order_count and avg_order_value, but it does not show up in the Features UI. What has to happen before this table can be used as a feature table?
In Unity Catalog, a primary key constraint is what makes a Delta table a feature table. No separate registration exists. Partitioning or exporting doesn't create a feature table, FeatureStoreClient is the legacy client, and a DBFS path doesn't identify a governed Unity Catalog table.
“You can use any Delta table in Unity Catalog that includes a primary key constraint as a feature table.”Source: docs.databricks.com
Checkpoint 2 of 9· Exam question
A data scientist has an existing Delta table retail.features.customer_orders with columns customer_id, order_count, and avg_order_value. She wants Feature Engineering in Unity Catalog to treat it as a usable feature table when she calls fe.create_training_set later. What must be true about the table for that to work?
Correct answer: A — The table must have a primary key constraint on customer_id, since a Delta table with a primary key already qualifies as a Unity Catalog feature table.
- A. Correct. In Unity Catalog-enabled workspaces, any Delta table that carries a primary key constraint already functions as a feature table, with no separate registration step needed.
- B. Incorrect.
FeatureStoreClientis the legacy Workspace Feature Store API used in non-Unity-Catalog workspaces; Unity Catalog feature tables are ordinary Delta tables identified by their primary key, not a separate registration call. - C. Incorrect. Partitioning is an optional performance setting for a feature table, not a requirement for Unity Catalog to recognize the table as a feature source during training-set creation.
- D. Incorrect. Feature tables stay inside Unity Catalog as governed Delta tables; exporting to Parquet outside Unity Catalog would remove the governance and lineage tracking rather than enable it.
Checkpoint 3 of 9· Exam question
An ML engineer is writing the Python call to create a new feature table for a churn model and needs to specify where the table will live. Which value should be passed as the name argument to FeatureEngineeringClient.create_table for it to be stored correctly in Unity Catalog?
Correct answer: A — A three-level identifier in catalog.schema.table form, like ml_prod.churn_features.customer_churn, matching Unity Catalog object naming.
- A. Correct. Unity Catalog feature tables are addressed with the same three-level namespace as every other Unity Catalog table, so
create_tableexpectscatalog.schema.table. - B. Incorrect. Unity Catalog does not silently substitute a default catalog for a missing qualifier; the catalog must be stated explicitly as part of the three-level name.
- C. Incorrect. There is no dedicated system catalog that feature tables fall back to; each feature table is created in whichever catalog and schema the caller specifies.
- D. Incorrect. Feature tables are governed Delta tables registered in Unity Catalog, not raw files addressed by a DBFS mount path.
2.FeatureEngineeringClient, not the legacy FeatureStoreClient
Unity Catalog feature tables have their own Python client, FeatureEngineeringClient, from the databricks-feature-engineering package. FeatureStoreClient belongs to the legacy Workspace Feature Store. It is the right client only for workspace feature tables, never for tables named catalog.schema.table. The older databricks-feature-store package was deprecated as of version 0.17.0. Its modules now ship inside databricks-feature-engineering from version 0.2.0 on, so an import such as from databricks.feature_store import FeatureStoreClient still works after you switch packages.
| Databricks Runtime | Feature tables in | Package | Python client |
|---|---|---|---|
| 14.3 ML and above | Unity Catalog | databricks-feature-engineering | FeatureEngineeringClient |
| 14.3 ML and above | Workspace | databricks-feature-engineering | FeatureStoreClient |
| 14.2 ML and below | Unity Catalog | databricks-feature-engineering | FeatureEngineeringClient |
| 14.2 ML and below | Workspace | databricks-feature-store | FeatureStoreClient |
Whether you need to install the client depends on the runtime. It is one of the Databricks Runtime ML pre-installed libraries from 13.3 LTS ML onward. On a non-ML runtime, install it yourself with %pip install databricks-feature-engineering, then restart Python with dbutils.library.restartPython(). A cluster on standard Databricks Runtime that fails on from databricks.feature_engineering import FeatureEngineeringClient is usually just missing this install.
The client only runs on Databricks. You can pip-install it on a laptop for IDE support and unit tests with mocks. It cannot call Feature Engineering APIs from outside Databricks, so create tables from a notebook or job on a cluster.
Checkpoint 4 of 9· Match them up
Each team below needs a feature-store client in its notebook. Match each setup to the package and Python client it should use.
Tap a term, then the definition that fits it.
Where the tables live decides the client: Unity Catalog tables always use FeatureEngineeringClient, and Workspace tables use FeatureStoreClient. The runtime only decides the package for Workspace tables. From 14.3 ML on, FeatureStoreClient ships inside databricks-feature-engineering.
“Databricks Runtime 14.3 ML and above | Workspace | databricks-feature-engineering | FeatureStoreClient”Source: docs.databricks.com
3.Creating a feature table with Databricks SQL
In SQL, you declare the primary key in the table definition. Mark each key column NOT NULL, then name the constraint in a CONSTRAINT ... PRIMARY KEY (...) clause. A composite key lists several columns inside the parentheses. Once the table exists, you can write to it like any other Delta table, and it already works as a feature table.
CREATE TABLE ml.recommender_system.customer_features (
customer_id int NOT NULL,
feat1 long,
feat2 varchar(100),
CONSTRAINT customer_features_pk PRIMARY KEY (customer_id)
);Because Databricks doesn't enforce the constraint, keeping keys unique is your job. Each feature computation should return a Spark DataFrame with one row per primary key value, and the key can span one or more columns. If the code that builds features emits two rows for the same customer, nothing stops it, and every downstream join inherits the duplicate.
One syntax limit catches people who build feature tables from a query: CREATE TABLE ... AS SELECT (CTAS) does not support the constraint clause. To build from a query, either define the table with its constraint and then insert into it, or run the CTAS and add the key afterwards with ALTER TABLE. The section on existing tables below covers the second route.
Checkpoint 5 of 9· Check yourself
A data engineer wants to build ml.recommender_system.customer_features from a SELECT over raw order data, with customer_id as the primary key. Which approach produces a usable feature table?
CTAS does not support the constraint clause. You can define the table with its primary key and then insert into it, or run the CTAS and add the key afterwards with ALTER TABLE. NOT NULL alone doesn't declare a key, and FeatureStoreClient is the legacy client, which doesn't manage Unity Catalog tables.
“CTAS statements don't support this constraint clause.”Source: docs.databricks.com
4.Creating a feature table with fe.create_table
In Python, you create an instance of FeatureEngineeringClient and call create_table. The arguments map onto the SQL version. name is the three-level identifier. primary_keys is a single column name or a list for a composite key. schema gives the column layout, often taken from the DataFrame your feature function returns. description is optional free text.
customer_feature_table = fe.create_table(
name='ml.recommender_system.customer_features',
primary_keys='customer_id',
schema=customer_features_df.schema,
description='Customer features'
)Passing schema= creates an empty table. Passing df= instead creates the table and writes the DataFrame's rows into the underlying Delta table in the same call, which is the shortest path for a one-off feature set. For a composite key, pass a list such as primary_keys=['customer_id', 'date']. All later writes go through fe.write_table and mode='merge', not through repeated create_table calls.
No. create_table creates the table, and passing df= only populates it at creation. Nightly runs should update the existing table with write_table instead.
Checkpoint 6 of 9· Fill the gap
This call should create an empty Unity Catalog feature table keyed on customer_id, with its columns taken from the feature DataFrame. Which argument name goes in the blank?
customer_feature_table = fe.create_table(
name='ml.recommender_system.customer_features',
? ='customer_id',
schema=customer_features_df.schema,
description='Customer features'
)In create_table, primary_keys declares the key that makes the table a feature table. It takes one column name or a list of names for a composite key. lookup_key isn't a create_table argument, partitioning doesn't make a table a feature table, and timeseries_columns marks a time column that is already part of the primary key. It doesn't take the place of the key.
Source: docs.databricks.comSources1
5.Turning an existing table or a Lakeflow output into a feature table
If you already have a Delta table, you don't need to rebuild it to use it as a feature table. Adding a primary key takes two ALTER TABLE statements:
- For each key column, run
ALTER TABLE <full_table_name> ALTER COLUMN <pk_col_name> SET NOT NULL. - Add the constraint with
ALTER TABLE <full_table_name> ADD CONSTRAINT <pk_name> PRIMARY KEY(pk_col1, pk_col2, ...).
By convention the constraint takes the table name plus _pk, so ml.recommender_system.customer_features gets customer_features_pk. After the constraint is added, the table appears in the Features UI.
Two things can still block this. First, only the table's owner can declare a primary key. The owner's name is on the table detail page in Catalog Explorer, so a data scientist who only has read and write access needs the owner to run step 2. Second, the column data types must be ones that Feature Engineering in Unity Catalog supports.
Tables published by Lakeflow pipelines follow a different rule. A Lakeflow streaming table or materialized view (pipeline datasets also covered in Lakeflow pipelines (DLT) for streaming inference) becomes a feature table as soon as it carries a primary key. You can't add that key with ALTER TABLE, though. You change the schema in the streaming table or materialized view definition to include the key, then refresh it. Table constraints in Lakeflow pipelines are in Public Preview and need the pipelines preview channel.
CREATE MATERIALIZED VIEW customer_features (
customer_id int NOT NULL,
feat1 long,
feat2 varchar(100),
CONSTRAINT customer_features_pk PRIMARY KEY (customer_id)
) AS SELECT * FROM ...;Checkpoint 7 of 9· Check yourself
A Lakeflow pipeline publishes the materialized view ml.features.customer_features to Unity Catalog. It has no primary key, and the team wants to use it as a feature table keyed on customer_id. Which approach works?
Lakeflow streaming tables and materialized views don't get their primary key through ALTER TABLE. You add the key to the dataset's schema definition and then refresh it. The owner-only rule applies to ALTER TABLE on existing Delta tables, so it doesn't make ALTER TABLE work on a pipeline output.
“requires modifying the schema of the streaming table or materialized view definition to include the primary key and then refreshing”Source: docs.databricks.com
Sources1
6.Time series feature tables and the TIMESERIES key
Fraud signals, sensor readings and rolling aggregates change over time, and that creates a leakage risk. If a training row picks up a feature value recorded after its label, the model learns from information it won't have in production. That kind of data leakage is hard to spot and can hurt the model's performance. A time series feature table prevents it by storing feature values over time, so a lookup returns the latest value as of each row's timestamp.
To create one, add the time column to the primary key and declare it as the time series column. In SQL, put the TIMESERIES keyword after that column in the primary key clause: PRIMARY KEY (customer_id, ts TIMESERIES). The keyword needs Databricks Runtime 13.3 LTS or above. On an existing table, the same keyword goes in the ADD CONSTRAINT statement. In Python, list the column in primary_keys and also pass it to timeseries_columns.
fe = FeatureEngineeringClient()
# Create a time series table for point-in-time joins
fe.create_table(
name="catalog.schema.user_behavior_features",
primary_keys=["user_id", "event_timestamp"],
timeseries_columns="event_timestamp", # Enables point-in-time logic
df=features_df # DataFrame must contain primary keys and time series columns
)A feature table does its work when training data is built from it. You pass create_training_set a label DataFrame (raw training rows with a ground-truth label column and a column for each primary key of the feature tables) plus a FeatureLookup per feature table, which names the table, the features to take and the lookup keys. The feature values are then joined onto the label rows by those keys. On a time series table, the declared timestamp changes that join: each label row receives the latest feature value not later than its own timestamp, instead of requiring an exact time match. Separately, publish_table copies a feature table to an online store for real-time inference.
Putting the timestamp in the primary key is necessary but not enough. Without timeseries_columns or TIMESERIES, a join matches only rows with exactly the same time instead of the latest earlier value. In Unity Catalog the table also becomes unusable with create_training_set, create_feature_spec and publish_table, because those APIs reject undeclared DATE or TIMESTAMP key columns. Other shortcuts fail as well. Storing the timestamp as an ordinary feature column, relying on merge writes to overwrite old values, or tagging the column all leave the table without any point-in-time logic.
Time series tables follow a few extra rules:
- There is exactly one timestamp key, and it must be
TimestampTypeorDateType. - The table cannot have partition columns.
- Databricks recommends no more than two primary key columns in total, for performant writes and lookups.
- Every write must supply values for all of the table's features, which regular feature tables don't require.
Checkpoint 8 of 9· Fill the gap
Without the right keyword in the key clause, joins on ts need an exact time match. Which keyword turns this SQL table into a time series feature table that supports point-in-time lookups?
CREATE TABLE ml.recommender_system.customer_features (
customer_id int NOT NULL,
ts timestamp NOT NULL,
feat1 long,
feat2 varchar(100),
CONSTRAINT customer_features_pk PRIMARY KEY (customer_id, ts ? )
);Having ts in the primary key is not enough. TIMESERIES after the column in the PRIMARY KEY clause declares it as the time series key, and that declaration enables point-in-time joins. TIMESTAMP is the column's data type and NOT NULL is already set on the column. Neither one declares a time series key, and TIMESTAMP_KEY is not a SQL keyword.
Source: docs.databricks.comCheckpoint 9 of 9· Exam question
A team is building a feature table for fraud detection where feature values change throughout the day and the training set must only use values that were known at each transaction's timestamp, to avoid leaking future information. Which approach correctly creates this table with FeatureEngineeringClient.create_table?
Correct answer: A — Include the timestamp column in primary_keys with the entity key, and pass that column to timeseries_columns so lookups respect point-in-time correctness.
- A. Correct. Time series feature tables require the time column to be part of the primary key and declared through
timeseries_columns, which is what enables point-in-time lookups during training-set creation. - B. Incorrect. Treating the timestamp as a plain schema column gives it no special meaning;
create_training_sethas no mechanism to infer time ordering from insertion order alone. - C. Incorrect. Omitting the timestamp key removes any way to look up feature values as of a specific point in time, and
mergemode write behavior does not substitute for that. - D. Incorrect.
tagsstore descriptive key-value metadata for humans and catalog search; they are not read by the training-set or lookup logic that enforces point-in-time correctness.
Practise it for real
Create a feature table in SQL, then turn a plain Delta table into a time series feature table, and confirm both appear in the Features UI.
1.In a notebook on Databricks Runtime 13.3 LTS or above, run CREATE SCHEMA IF NOT EXISTS for a schema in a catalog where you hold USE CATALOG and CREATE SCHEMA.
Why: Feature tables need a three-level name, so the catalog and schema must exist first.
You should see: The schema appears under the catalog in Catalog Explorer.
2.Run a CREATE TABLE with customer_id int NOT NULL, two feature columns, and CONSTRAINT customer_features_pk PRIMARY KEY (customer_id), using your catalog.schema.customer_features name.
Why: Declaring the primary key when the table is created is enough to make it a feature table.
You should see: Select your catalog in the Features page of the sidebar and the table is listed there.
3.Create a second table with columns customer_id int, ts timestamp and one feature column, without any constraint. Run ALTER TABLE ... ALTER COLUMN ... SET NOT NULL for customer_id and for ts.
Why: Primary key columns must be NOT NULL before the constraint can be added.
You should see: Both statements succeed. The table is not listed in the Features UI yet.
4.Run ALTER TABLE on the second table's full catalog.schema.table name with ADD CONSTRAINT and a constraint name ending in _pk, followed by PRIMARY KEY(customer_id, ts TIMESERIES).
Why: The TIMESERIES keyword makes ts the timestamp key for point-in-time lookups. Only the table owner can add this constraint.
You should see: The table now appears in the Features UI as a time series feature table.
Stuck? Get a nudge
If ADD CONSTRAINT fails with a permissions error, check who owns the table on its Catalog Explorer detail page.
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Feature tables, like other data assets in Unity Catalog, are accessed using a three-level namespace: <catalog-name>.<schema-name>.<table-name>.”
↩︎ A feature table is a Delta table with a primary key“Feature Engineering in Unity Catalog requires Databricks Runtime 13.2 or above.”
↩︎ A feature table is a Delta table with a primary key“Feature tables in Unity Catalog must be stored in a schema.”
↩︎ A feature table is a Delta table with a primary key“is pre-installed in Databricks Runtime 13.3 LTS ML and above. If you use a non-ML Databricks Runtime, you must install the client manually.”
↩︎ FeatureEngineeringClient, not the legacy FeatureStoreClient“The output of each function should be an Apache Spark DataFrame with a unique primary key.”
↩︎ Creating a feature table with Databricks SQL“This code automatically saves the features to the underlying Delta table.”
↩︎ Creating a feature table with fe.create_table“Only the table owner can declare primary key constraints.”
↩︎ Turning an existing table or a Lakeflow output into a feature table“the table appears in the Features UI and you can use it as a feature table.”
↩︎ Turning an existing table or a Lakeflow output into a feature table“Lakeflow pipelines support for table constraints is in Public Preview.”
↩︎ Turning an existing table or a Lakeflow output into a feature table“To create a time series feature table, add a time column as a primary key column and specify the TIMESERIES keyword.”
↩︎ Time series feature tables and the TIMESERIES key“The TIMESERIES keyword requires Databricks Runtime 13.3 LTS or above.”
↩︎ Time series feature tables and the TIMESERIES key“In Unity Catalog, any Delta table with a primary key constraint can serve as a feature table.”
↩︎ Key concept“adding a primary key to a streaming table or materialized view that was published to Unity Catalog by Lakeflow pipelines requires modifying the schema”
↩︎ Exam trap 4“requires modifying the schema of the streaming table or materialized view definition to include the primary key and then refreshing”
↩︎ Checkpoint - 2.
“Any table managed by Unity Catalog that has a primary key is automatically a feature table and appears on this page.”
↩︎ A feature table is a Delta table with a primary key“You can use any Delta table in Unity Catalog that includes a primary key constraint as a feature table.”
↩︎ Checkpoint - 3.
“As of version 0.17.0, databricks-feature-store has been deprecated.”
↩︎ FeatureEngineeringClient, not the legacy FeatureStoreClient“It does not support calling Feature Engineering in Unity Catalog or Feature Store APIs from a local environment”
↩︎ FeatureEngineeringClient, not the legacy FeatureStoreClient“To work with feature tables in Unity Catalog, use FeatureEngineeringClient. To use Workspace Feature Store, you must use FeatureStoreClient.”
↩︎ Exam trap 2“Databricks Runtime 14.3 ML and above | Workspace | databricks-feature-engineering | FeatureStoreClient”
↩︎ Checkpoint - 4.
“CTAS statements don't support this constraint clause.”
↩︎ Creating a feature table with Databricks SQL“Primary key, foreign key, and unique constraints are informational only and aren't enforced.”
↩︎ Exam trap 3“Primary key, foreign key, and unique constraints are informational only and aren't enforced.”
↩︎ Prediction - 5.
“data leakage, which occurs when you use feature values for model training that were not available at the time the label was recorded.”
↩︎ Time series feature tables and the TIMESERIES key“A time series feature table must have one timestamp key and cannot have any partition columns.”
↩︎ Time series feature tables and the TIMESERIES key“The timestamp key column must be of TimestampType or DateType.”
↩︎ Time series feature tables and the TIMESERIES key“Databricks recommends that time series feature tables have no more than two primary key columns”
↩︎ Time series feature tables and the TIMESERIES key“your DataFrame must supply values for all features of the feature table, unlike regular feature tables.”
↩︎ Time series feature tables and the TIMESERIES key“feature store does not apply point-in-time logic to the time series column during joins.”
↩︎ Exam trap 1“These APIs require that all DATE and TIMESTAMP primary key columns are declared as timeseries columns.”
↩︎ Prediction - 6.
“The data in the feature tables is joined to the input DataFrame according to these keys.”
↩︎ Time series feature tables and the TIMESERIES key“You can publish a feature table to an online store for real-time model inference.”
↩︎ Time series feature tables and the TIMESERIES key