A data engineer is building a production Databricks Workflow that runs a Python notebook as Task A, followed by a SQL task as Task B. They want Task B to receive a string output value produced by Task A (e.g., the name of a newly created table). What is the correct mechanism to pass this value between tasks?
- A. Pass the value as a job parameter when configuring the dependency between Task A and Task B in the UI
- B. Write the value to a Delta table from Task A and read it back in Task B using a SELECT statement
- C. Store the value in a Databricks secret scope and retrieve it in Task B
- D. Use dbutils.jobs.taskValues.set() in Task A and dbutils.jobs.taskValues.get() in Task B✓ Correct
Explanation
Databricks Workflows provides the Task Values API (dbutils.jobs.taskValues.set() and dbutils.jobs.taskValues.get()) specifically for passing lightweight key-value outputs between tasks in the same job run. Writing to a Delta table works functionally but is not the intended mechanism for inter-task communication and introduces unnecessary overhead. Secret scopes are for storing credentials, not dynamic run-time values produced by tasks. Job parameters are set at the job level before the run begins and cannot be dynamically set by one task for consumption by another during the same run.