
Answer-first summary for fast verification
Answer: dbutils.widgets.text("date", "null") date = dbutils.widgets.get("date")
The correct approach to retrieve the date parameter passed via the Databricks Jobs API (notebook_params) is to use widgets. Widgets must be explicitly defined in the notebook to access parameters passed through notebook_params. Option E correctly defines a text widget and retrieves its value using `dbutils.widgets.get("date")`. Other options are incorrect: A uses Spark config (not parameters), B uses input() (interactive, not for jobs), C uses sys.argv (for command-line args, not notebook tasks), and D uses `getParam` (for notebook workflows, not Jobs API).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How should the date Python variable be defined in the notebook to dynamically load data from the specified path using the date parameter passed by the upstream system via the Databricks Jobs API?
A
date = spark.conf.get("date")
B
input_dict = input() date= input_dict["date"]
C
import sys date = sys.argv[1]
D
date = dbutils.notebooks.getParam("date")
E
dbutils.widgets.text("date", "null") date = dbutils.widgets.get("date")
No comments yet.