New daily rows must update existing customers and add new ones in a feature table. Which call fits?
- 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: Write data to a feature store table
Writing to a feature table is named.
Why D is the answer
fe.write_table(name="main.ml.customer_features", df=updates, mode="merge")
write_table with mode="merge" upserts on the primary key, updating existing rows and inserting new ones.
Remember: Merge to upsert features.
How it works
write_table merges on primary keys.
In detail
- merge upserts on the key.
- create_table is one-time.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. fe.create_table(name="main.ml.customer_features", primary_keys=["customer_id"], df=updates) again each dayWrongMost tempting
create_table fails if the table exists.
Why it tempts: Recreating feels like refreshing.
B. Drop the table and recreate itWrong
Dropping loses history and breaks consumers.
C. Append rows with duplicate keys and let readers pickWrong
Duplicate keys break lookups.
D. fe.write_table(name="main.ml.customer_features", df=updates, mode="merge")Right
Merge to upsert features.
Use case
An illustrative scenario, not a real incident.
Illustrative: a daily job merges 50,000 changed customer rows into the feature table.
See it in different ways
flowchart TD
Q{"What do the new rows do?"}
Q -->|"Update and insert by key"| A0["merge"]
Q -->|"Full replacement"| A1["overwrite"]How to read this chart
- At "What do the new rows do?": if "Update and insert by key", go to "merge"; if "Full replacement", go to "overwrite".
stateDiagram-v2 state "Existing key" as s0 state "Updated" as s1 state "New key" as s2 state "Inserted" as s3 [*] --> s0 s0 --> s1: merge with new values s2 --> s3: merge adds row s1 --> [*] s3 --> [*]
How to read this chart
- It starts at "Existing key".
- From "Existing key", "merge with new values" moves it to "Updated".
- From "New key", "merge adds row" moves it to "Inserted".
- It ends at "Updated" or "Inserted".