Databricks Data Engineer Associate · Free practice question 3 of 12
Reading notebook task parameters
A notebook at Glenrock Energy is run by a Lakeflow Job that passes a parameter named run_date to the notebook task. Inside the notebook, how should the code read that value?
- A.spark.conf.get('run_date')
- B.dbutils.widgets.get('run_date')
- C.os.environ['run_date']
- D.dbutils.fs.head('run_date')
Show answer and explanation
Correct answer: B. dbutils.widgets.get('run_date')
Why: Parameters passed to a notebook task are exposed to the notebook as widget values, which the code reads with dbutils.widgets.get. They are not set as Spark configuration values or environment variables, and dbutils.fs.head reads the beginning of a file.
More free Databricks Data Engineer Associate questions
- Delta shallow vs deep clone
- Auto Loader schema hints
- collect_set vs collect_list aggregation
- Triggered vs continuous pipeline mode
- Job maximum concurrent runs
- Job task timeout setting
- SHOW GRANTS on Unity Catalog objects
- Transferring object ownership
- Compute policies for cluster governance
- ALTER TABLE ADD COLUMNS on Delta
- Spark lazy evaluation transformations vs actions