Databricks Certified Data Engineer Professional Practice Questions

Databricks Certified Data Engineer Professional exam preparation

Databricks Certified Data Engineer Professional practice questions in English: 178 questions with explanations. The mock exam has 60 questions and 120 minutes.

Databricks Certified Data Engineer Professional free question 1 / 10 · Domain 1: Developing Code for Data Processing using Python and SQL

A Declarative Automation Bundles project contains some jobs defined in YAML and some defined in Python. At deploy time you want to add a failure notification (email_notifications) addressed to the user running the deployment to the jobs that do not have one yet. Jobs that already have notifications must stay unchanged. How do you set this up?

  1. Define the recipient under variables in databricks.yml so that it is applied at deploy time as a default setting, including to jobs that do not reference ${var.recipient}
  2. Decorate a function with @job_mutator that returns a job as it is if it already has a notification and adds one if not, and list it under python > mutators in databricks.yml
  3. Decorate a function with @job_mutator that adds the notification to jobs without one, put it in mutators.py, and import it in resources/__init__.py; the deploy then calls it automatically
  4. Inside the load_resources function, add the notification to each job it loads and return the job. YAML jobs are also passed to load_resources, so the change reaches both kinds of job
Show the answer and explanation

Answer: B

Why this is correct
A Python mutator can rewrite resources at deploy time, whether they were defined in YAML or in Python. A function decorated with @job_mutator is called once for each job in the bundle and returns either a modified copy or the job it received. Returning jobs that already have notifications unchanged, and returning a copy with the notification added (for example through dataclasses.replace) for jobs that have none, meets the requirement. Mutators run in the order they are listed under python > mutators in databricks.yml, independently of how resources are loaded with load_resources.

Why the other options are wrong
"Decorate a function with @job_mutator that adds the notification to jobs without one, put it in mutators.py, and import it in resources/__init__.py; the deploy then calls it automatically" … A mutator function runs when its name is listed under mutators in databricks.yml. Putting the file in place and importing it does not register it, so the deploy adds no notification to any job.
"Inside the load_resources function, add the notification to each job it loads and return the job. YAML jobs are also passed to load_resources, so the change reaches both kinds of job" … load_resources is the entry point that loads resources defined in Python; its default implementation reads the Python files of the resources package. It does not receive YAML-defined jobs and rewrite them, so the YAML jobs would keep missing the notification.
"Define the recipient under variables in databricks.yml so that it is applied at deploy time as a default setting, including to jobs that do not reference ${var.recipient}" … A custom variable only fills in a value where ${var.name} is written at deploy time. It never gets injected as a default into the settings of jobs that do not reference it, so jobs without a notification would be deployed without one.

Key point
If a mutator raises an exception, the bundle deployment itself is aborted. The same mechanism can apply a uniform rewrite to every job, such as setting a default job cluster or SQL warehouse. Switching behavior per target, such as enabling schedules only in production, is handled by deployment modes and presets instead.

Go to the Databricks Certified Data Engineer Professional practice app (10 free questions; purchase unlocks all questions)

See the full practice set