Databricks Certified Data Engineer Professional free question 9 / 10 · Domain 8: Debugging and Deploying
For the bundle variable catalog_name, the default of the top-level variables is dev_cat, targets.prod.variables in databricks.yml is prod_cat, and .databricks/bundle/prod/variable-overrides.json is ovr_cat. In CI the environment variable BUNDLE_VAR_catalog_name=cicd_cat is set, and databricks bundle deploy -t prod is run without --var. Which value is used?
- prod_cat
- cicd_cat
- dev_cat
- ovr_cat
Show the answer and explanation
Answer: B
Why this is correct
Under Precedence order, the Databricks CLI looks for a variable's value in the following order and stops where it finds one: first --var on the bundle command, second an environment variable that starts with BUNDLE_VAR_, third variable-overrides.json, fourth variables inside targets, and fifth the default of the top-level variables. There is no --var, and the environment variable BUNDLE_VAR_catalog_name exists, so the search stops at cicd_cat. The nearer a setting is to run time, the stronger it is, which makes it easy to override from CI.
Why the other options are wrong
"ovr_cat" … variable-overrides.json is consulted after environment variables that start with BUNDLE_VAR_. The environment variable has a value, so the search stops there and ovr_cat is not used. This value is used when neither --var nor the environment variable exists.
"prod_cat" … The variables inside targets are consulted after --var, environment variables, and variable-overrides.json. The environment variable has a value, so the search does not get as far as prod_cat written in the target.
"dev_cat" … The default of the top-level variables is used last, when no value exists anywhere else. Here the environment variable has a value, so the default dev_cat is not used.
Key point
Values are passed in the form --var="<key>=<value>" on the bundle command or as an environment variable whose name starts with BUNDLE_VAR_. The value actually used can be checked with databricks bundle validate --output json.