What you will be able to do
- State what makes a Unity Catalog table a feature table
- List the runtime, client and privilege prerequisites for Feature Engineering in Unity Catalog
- Create a feature table with a SQL PRIMARY KEY constraint or with fe.create_table
- Populate a feature table with fe.write_table
Key concept
Feature table in Unity Catalog — A Delta table in Unity Catalog that has a primary key constraint. You don't register it as a separate kind of object. The primary key is what lets Databricks treat the table as a source of features.
1.What makes a table a feature table
With the legacy Workspace Feature Store, a feature table was something the feature store client created and tracked. Unity Catalog works differently. A feature table is a Delta table with a primary key. The Feature Store overview lists this as the second step of the standard workflow, right after you turn raw data into a Spark DataFrame of features: create a Delta table in Unity Catalog that has a primary key.
Two rules follow. First, the primary key is required. Each feature table needs one, and Databricks keeps metadata alongside the Delta table that records which data sources built it and which notebooks and jobs wrote to it. Second, a feature table is an ordinary Unity Catalog data asset, so you address it with the usual three-level name <catalog-name>.<schema-name>.<table-name>. The examples in this lesson use ml.recommender_system.customer_features: catalog ml, schema recommender_system, table customer_features.
There are three ways to create one: Databricks SQL, the Python FeatureEngineeringClient, or Lakeflow pipelines. This page covers the first two. Whichever you pick, the result is a Delta table with a primary key, and that table can then be updated, browsed and governed through Unity Catalog.
Checkpoint 1 of 8· Check yourself
Which requirement must every feature table in Unity Catalog meet?
The primary key is the one requirement. Registration through the client, online publishing and the legacy store are not needed for a Unity Catalog feature table.
“Feature tables must have a primary key.”Source: docs.databricks.com
It's a convenience, not a requirement. You can pass a DataFrame's schema, or the DataFrame itself so the features are saved straight away, and declare primary keys and time series columns from Python. A SQL CREATE TABLE with a PRIMARY KEY constraint produces a table that is just as valid.
2.Prerequisites: runtime, client and privileges
Check four things before you create anything.
Runtime and metastore. Feature Engineering in Unity Catalog needs Databricks Runtime 13.2 or above, and the Unity Catalog metastore must use Privilege Model Version 1.0.
Python client. The client class is FeatureEngineeringClient, from the databricks-feature-engineering package on PyPI. It comes pre-installed in Databricks Runtime 13.3 LTS ML and above. On a non-ML runtime you install it yourself with %pip install databricks-feature-engineering and then run dbutils.library.restartPython(). The client runs only on Databricks. You can install it locally for unit tests with mocks, but it can't call Feature Engineering APIs from outside Databricks.
Catalog. Feature tables need a catalog. Creating a new one with CREATE CATALOG IF NOT EXISTS <catalog-name> requires the CREATE CATALOG privilege on the metastore. Using an existing one requires USE CATALOG on that catalog.
Schema. Feature tables have to live in a schema. Creating one with CREATE SCHEMA IF NOT EXISTS <schema-name> requires the CREATE SCHEMA privilege on the catalog.
Which client you use depends on where the table lives, not on the runtime version:
| 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 |
Checkpoint 2 of 8· Check yourself
A team on Databricks Runtime 14.2 ML wants to create feature tables in Unity Catalog. Which client should they instantiate?
Unity Catalog tables always use FeatureEngineeringClient, whatever the runtime version. FeatureStoreClient is for the Workspace Feature Store.
“To work with feature tables in Unity Catalog, use FeatureEngineeringClient.”Source: docs.databricks.com
Checkpoint 3 of 8· Check yourself
A user wants to put feature tables in a new schema inside an existing catalog. Which pair of privileges do they need?
Using an existing catalog requires USE CATALOG, and creating a schema inside it requires CREATE SCHEMA on that catalog. CREATE CATALOG matters only when you create a new catalog.
“To create a new schema in the catalog, you must have the CREATE SCHEMA privilege on the catalog.”Source: docs.databricks.com
3.Creating a feature table with Databricks SQL
The SQL route is a normal CREATE TABLE with two additions. The key column is declared NOT NULL, and a named CONSTRAINT ... PRIMARY KEY clause says which column or columns identify each row. Nothing marks the table as a feature table. The constraint does that on its own.
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)
);Once the table exists you load data into it the same way as any other Delta table, and it already works as a feature table. The constraint name follows a convention: the table name without catalog and schema, plus _pk. That gives customer_features_pk here.
Checkpoint 4 of 8· Check yourself
After running the CREATE TABLE statement above, what else is needed before ml.recommender_system.customer_features can be used as a feature table?
The primary key constraint is enough. No registration call is needed, and TIMESERIES is only for time series tables.
“After the table is created, you can write data to it like other Delta tables, and it can be used as a feature table.”Source: docs.databricks.com
Sources2
4.Creating a feature table with fe.create_table
In Python you start from the features. Write a function that computes them and returns an Apache Spark DataFrame with a unique primary key, which can be a single column or several. Then instantiate FeatureEngineeringClient and call create_table. You give it the three-level name, the primary key, and the table's shape. There are two ways to supply the shape:
- schema=customer_features_df.schema creates an empty table with the DataFrame's schema.
- df=customer_features_df creates the table and also saves the features to the underlying Delta table straight away.
The documented arguments:
| Argument | Example value | Purpose |
|---|---|---|
| name | 'ml.recommender_system.customer_features' | Three-level Unity Catalog name of the table |
| primary_keys | 'customer_id' or ['customer_id', 'date'] | One column, or a list for a composite key |
| schema | customer_features_df.schema | Takes the table schema from the computed DataFrame |
| df | customer_features_df | Alternative to schema that also saves the features to the Delta table |
| timeseries_columns | 'date' | Marks a primary key column as the time series key |
| description | 'Customer features' | Text description of the table |
Checkpoint 5 of 8· Fill the gap
Which argument declares the key that identifies each row of the feature table?
customer_feature_table = fe.create_table(
name='ml.recommender_system.customer_features',
? ='customer_id',
schema=customer_features_df.schema,
description='Customer features'
)primary_keys takes one column name or a list for a composite key. timeseries_columns only marks a time column, and lookup_key isn't a create_table argument.
Source: docs.databricks.comCheckpoint 6 of 8· 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. `FeatureStoreClient` is 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.
Sources2
5.Populating the table with fe.write_table
If you created the table with schema=, it's empty. You fill it, and later refresh it, with write_table, passing the table name and a DataFrame of feature values. The documented examples use mode="merge", both in the time series write sample below and in the unit-test example for FeatureEngineeringClient.write_table.
fe.write_table(
"ml.ads_team.user_features",
daily_users_batch_df,
mode="merge"
)Checkpoint 7 of 8· Put it in order
Put the Python steps for building a Unity Catalog feature table in order
- 1.Instantiate FeatureEngineeringClient and call create_table
- 2.Populate the feature table using write_table
- 3.Write a function that computes the features as a Spark DataFrame with a unique primary key
The DataFrame comes first because create_table takes its schema from it. write_table then loads the values into the table that create_table made.
“Create a feature table by instantiating a FeatureEngineeringClient and using create_table.”Source: docs.databricks.com
Checkpoint 8 of 8· 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_set` has 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 `merge` mode write behavior does not substitute for that.
- D. Incorrect. `tags` store 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.
Sources2
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Only tables created with fe.create_table count as feature tables in Unity Catalog.Why is that wrong?
Any Unity Catalog Delta table with a primary key constraint is a feature table, including one created in plain SQL. It appears in the Features UI automatically.
Covered in What makes a table a feature table
2.FeatureStoreClient is the client for creating feature tables in Unity Catalog.Why is that wrong?
FeatureStoreClient is for the legacy Workspace Feature Store. Unity Catalog feature tables use FeatureEngineeringClient on every runtime version.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Create a Delta table in Unity Catalog that has a primary key.”
↩︎ What makes a table a feature table“Each table must have a primary key, and is backed by a Delta table and additional metadata.”
↩︎ What makes a table a feature table - 2.
“Feature tables, like other data assets in Unity Catalog, are accessed using a three-level namespace”
↩︎ What makes a table a feature table“Feature Engineering in Unity Catalog requires Databricks Runtime 13.2 or above.”
↩︎ Prerequisites: runtime, client and privileges“If you use a non-ML Databricks Runtime, you must install the client manually.”
↩︎ Prerequisites: runtime, client and privileges“To create a new catalog, you must have the CREATE CATALOG privilege on the metastore.”
↩︎ Prerequisites: runtime, client and privileges“You can use any Delta table with a primary key constraint as a feature table.”
↩︎ Creating a feature table with Databricks SQL“By convention, you can use the table name (without schema and catalog) with a _pk suffix.”
↩︎ Creating a feature table with Databricks SQL“The output of each function should be an Apache Spark DataFrame with a unique primary key.”
↩︎ Creating a feature table with fe.create_table“This code automatically saves the features to the underlying Delta table.”
↩︎ Creating a feature table with fe.create_table“To use a composite primary key, pass all primary key columns in the create_table call”
↩︎ Creating a feature table with fe.create_table“Populate the feature table using write_table.”
↩︎ Populating the table with fe.write_table“In Unity Catalog, any Delta table with a primary key constraint can serve as a feature table.”
↩︎ Key concept“Feature tables must have a primary key.”
↩︎ Checkpoint“To create a new schema in the catalog, you must have the CREATE SCHEMA privilege on the catalog.”
↩︎ Checkpoint“After the table is created, you can write data to it like other Delta tables, and it can be used as a feature table.”
↩︎ Checkpoint“Create a feature table by instantiating a FeatureEngineeringClient and using create_table.”
↩︎ Checkpoint - 3.
“The client library can only be run on Databricks, including Databricks Runtime and Databricks Runtime for Machine Learning.”
↩︎ Prerequisites: runtime, client and privileges“To use Workspace Feature Store, you must use FeatureStoreClient.”
↩︎ Exam trap 2“To work with feature tables in Unity Catalog, use FeatureEngineeringClient.”
↩︎ Checkpoint
Also cited
“Any table managed by Unity Catalog that has a primary key is automatically a feature table and appears on this page.”
↩︎ Exam trap 1“Any table managed by Unity Catalog that has a primary key is automatically a feature table and appears on this page.”
↩︎ Prediction