
Explanation:
When a Databricks Job is triggered through the Jobs API using base_parameters, Databricks automatically injects these key-value pairs into the notebook session as Widgets.
dbutils.widgets.text("key", "default") to ensure the widget exists (especially helpful for interactive development) and then use dbutils.widgets.get("key") to retrieve the value passed by the API.spark.conf is used for Spark configuration properties, not for job parameters passed via the Jobs API.sys.argv is used for passing arguments to standalone Python scripts, but it is not populated with job parameters in Databricks notebooks.dbutils.notebook.run() parameters are distinct from the Job API's base_parameters. There is no dbutils.notebooks.getParam method for job parameters.input() function is designed for interactive CLI input, which is not supported during automated Job execution.Ultimate access to all questions.
No comments yet.
An upstream system triggers a Databricks Job via the Jobs API and passes a date parameter using the base_parameters configuration (e.g., {"date": "2025-07-26"}). Which Python code snippet must be used within the notebook to retrieve this value and assign it to a variable?
A
date = spark.conf.get("date")
date = spark.conf.get("date")
B
import sys
date = sys.argv[1]
import sys
date = sys.argv[1]
C
date = dbutils.notebooks.getParam("date")
date = dbutils.notebooks.getParam("date")
D
dbutils.widgets.text("date", "null")
date = dbutils.widgets.get("date")
dbutils.widgets.text("date", "null")
date = dbutils.widgets.get("date")
E
input_dict = input()
date = input_dict["date"]
input_dict = input()
date = input_dict["date"]