Which code creates a feature table in Unity Catalog from a DataFrame keyed by customer_id?
- Exam domain
- Databricks Machine Learning36% of the exam
- Difficulty
- Medium
- In this mock
- 18 questions on this domainPractise this domain
Why the exam asks this
Databricks Machine Learning (36% of the exam)
Objective in the exam guide: Create a feature store table in Unity Catalog
Creating a feature store table in Unity Catalog is named.
Why D is the answer
FeatureEngineeringClient().create_table(name="main.ml.customer_features", primary_keys=["customer_id"], df=df)
The FeatureEngineeringClient creates feature tables in Unity Catalog. A three-level name and a primary key are needed.
Remember: Use FeatureEngineeringClient.create_table.
How it works
Feature tables in Unity Catalog are Delta tables with primary keys.
In detail
- FeatureEngineeringClient.create_table.
- Three-level name, primary key.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. mlflow.log_table(df, "customer_features")Wrong
log_table logs an artifact to a run.
B. spark.sql("CREATE FEATURE customer_features")Wrong
That SQL syntax does not exist.
C. df.write.format("feature").option("primaryKey", "customer_id").saveAsTable("main.ml.customer_features")WrongMost tempting
There is no "feature" write format.
Why it tempts: It looks like a normal DataFrame write.
D. FeatureEngineeringClient().create_table(name="main.ml.customer_features", primary_keys=["customer_id"], df=df)Right
Use FeatureEngineeringClient.create_table.
Use case
An illustrative scenario, not a real incident.
Illustrative: a nightly job computes spend features and creates main.ml.customer_features once.
See it in different ways
flowchart LR S0["Compute features"] --> S1["Pick primary key"] --> S2["create_table"] --> S3["write_table on updates"]
How to read this chart
- Read it in order: Compute features, then Pick primary key, then create_table, then write_table on updates.
sequenceDiagram participant P0 as Notebook participant P1 as FeatureEngineeringClient participant P2 as Unity Catalog P0->>P1: create_table with primary key P1->>P2: Delta table registered as feature table
How to read this chart
- 1. Notebook sends "create_table with primary key" to FeatureEngineeringClient.
- 2. FeatureEngineeringClient sends "Delta table registered as feature table" to Unity Catalog.