CertKeen

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?

  1. A.spark.conf.get('run_date')
  2. B.dbutils.widgets.get('run_date')
  3. C.os.environ['run_date']
  4. 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