Databricks Machine Learning · Topic 3 of 6
Feature Tables in Unity Catalog
Databricks ML Associate: why Unity Catalog feature tables beat workspace ones, plus create_table and write_table with FeatureEngineeringClient.
- 5 min
- A Unity Catalog feature table is a Delta table with a primary key constraint, named catalog.schema.table.
- Use FeatureEngineeringClient from databricks-feature-engineering; FeatureStoreClient is the legacy workspace client.
- UC benefits: shared across workspaces on the metastore, UC access control, lineage, discovery with tags.
What it is
A feature table stores precomputed model inputs, one row per entity (customer, product, device), keyed by a primary key. In Unity Catalog a feature table is simply a Delta table with a primary key constraint, governed like any other table.
The exam says "feature store table". Today the product is called Feature Engineering in Unity Catalog, installed as the databricks-feature-engineering package and used through FeatureEngineeringClient. The older workspace Feature Store and its FeatureStoreClient are legacy and apply only to workspaces not enabled for Unity Catalog.
How it works
Account level versus workspace level
A Unity Catalog metastore sits at the account level and can be attached to many workspaces. A workspace feature store belongs to one workspace.
| Unity Catalog feature table | Workspace feature store table | |
|---|---|---|
| Scope | Every workspace attached to the metastore | Only the workspace that created it |
| Name | Three levels: catalog.schema.table | Two levels: database.table |
| Access control | Unity Catalog grants on catalog, schema and table | Workspace level permissions |
| Lineage | Tracked from data to feature table to model and endpoint | Limited to that workspace |
| Discovery | Searchable in Catalog Explorer and the Features UI, with tags | Visible only inside one workspace |
| Which tables qualify | Any Delta table with a primary key, including streaming tables and materialized views | Tables created through the Feature Store client |
| Status | Current | Legacy |
The headline benefits are reuse across workspaces, central governance, and lineage. A team in the production workspace can read features that the development team built, without copying data.
Creating a feature table
You need a primary key. Create the table from a DataFrame (schema and data in one step) or from a schema only, then write data later.
from databricks.feature_engineering import FeatureEngineeringClient
fe = FeatureEngineeringClient()
fe.create_table(
name="ml.retail.customer_features",
primary_keys=["customer_id"],
df=customer_features_df,
description="Customer purchase features")
Passing schema=customer_features_df.schema instead of df creates an empty table with that structure. For time series features, add the time column to primary_keys and name it in timeseries_columns, which enables point in time lookups later.
You can also create one in SQL, because any Delta table with a primary key is a feature table. The primary key columns must be NOT NULL.
CREATE TABLE ml.retail.customer_features (
customer_id BIGINT NOT NULL,
orders_30d INT,
CONSTRAINT customer_pk PRIMARY KEY (customer_id));
Writing data to a feature table
write_table writes a DataFrame into an existing feature table.
fe.write_table(
name="ml.retail.customer_features",
df=new_features_df,
mode="merge")
With mode="merge", rows whose primary key already exists are updated, new keys are inserted, and rows not in the DataFrame are left unchanged. This is an upsert, which makes daily refresh jobs safe to rerun.
Worked example
The table holds customers 1, 2 and 3. A refresh DataFrame contains customers 2 and 4. After a merge, customer 2 is updated, customer 4 is added, and customers 1 and 3 keep their old values, so the table has four rows.
How the exam asks about this
- "Features built in one workspace must be reused by teams in two other workspaces with central access control." Create them as Unity Catalog feature tables, which every workspace on the metastore can use under UC grants.
- "Update today's feature values for existing customers and add new customers, keeping all other rows." Call write_table with mode="merge".
- "Which argument is required to create a feature table?" The primary_keys (with the three-level name), plus either a df or a schema.
What to remember for the exam
- A Unity Catalog feature table is a Delta table with a primary key constraint, named catalog.schema.table.
- Use FeatureEngineeringClient from databricks-feature-engineering; FeatureStoreClient is the legacy workspace client.
- UC benefits: shared across workspaces on the metastore, UC access control, lineage, discovery with tags.
- create_table needs name and primary_keys plus df or schema; description and timeseries_columns are optional.
- write_table with mode="merge" upserts by primary key and leaves other rows alone.
- Streaming tables and materialized views from Lakeflow pipelines (formerly Delta Live Tables) can be feature tables if they have a primary key.
An answer that uses FeatureStoreClient or a two-level database.table name describes the legacy workspace feature store. For Unity Catalog, look for FeatureEngineeringClient and a three-level name.
Common mistakes
Forgetting the primary key. Without a primary key a Delta table is not a feature table, and lookups have nothing to join on. Primary key columns must also be non-null.
Thinking merge replaces the table. Merge only touches keys that appear in the new DataFrame. Rows for other keys are kept, so a merge never deletes data.
Copying feature tables between workspaces. With Unity Catalog there is no need. Any workspace attached to the same metastore reads the same table, governed by the same grants.
Check yourself
What makes a Delta table in Unity Catalog usable as a feature table?
A primary key constraint on non-null columns; any such Delta table in Unity Catalog can be used as a feature table.
What does write_table with mode="merge" do with existing rows not in the new DataFrame?
It leaves them unchanged; only rows whose keys appear in the DataFrame are updated, and new keys are inserted.
What are two benefits of Unity Catalog feature tables over workspace feature store tables?
They are available to every workspace attached to the metastore, and they are governed by Unity Catalog access control with lineage to the models that use them.
Topic 3 of 6 in Databricks Machine Learning
Test yourself on Databricks Machine Learning
The full Databricks Machine Learning Associate question bank has 600 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.