Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Data Engineer Professional

Lakeflow Jobs: API, CLI, If/else, and For each

Databricks Data Engineer Professional · Lesson 7 of 21 · 52:49

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Data Engineer Professional exam. In this lesson: building Lakeflow Jobs from the UI, the REST API, and the Databricks CLI, job and task parameters, task values, If/else condition tasks, and For each loops. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Jobs clicked together

Quayside Eats runs its nightly ETL as jobs that an engineer created by clicking through the UI, one per region, and starts them by hand when a region needs a rerun. The team now wants to create and start jobs from scripts, skip the loyalty step when there are no new orders, and process twelve regions without twelve copies of the same task. This lesson covers Lakeflow Jobs through the UI, the API, and the CLI, with parameters, If/else conditions, and For each loops.

UI, API, and CLI

Lakeflow Jobs, formerly Workflows, orchestrate tasks: notebooks, Python scripts and wheels, SQL, pipelines, dbt, and other jobs, with dependencies between them. In the UI, Jobs and Pipelines, then Create, then Job, sets up the tasks, the compute, the schedule or trigger, and the notifications, and Switch to code version shows the job as YAML. The Jobs API does the same from any tool, over REST: create takes the job settings as JSON, and run-now starts a run and returns its run ID. The Databricks CLI wraps the API: jobs create with a JSON file, run-now with a job ID, list and get, and reset, which overwrites all the settings of a job, while update changes only some of them. Submit starts a one time run without creating a job, and the Python SDK offers the same calls, like the jobs create method. For job definitions kept in Git, Databricks recommends bundles, which deploy the same definition to every environment.

Parameters and task values

Job parameters are key value pairs that every task of a job receives, and they can be overridden for one run, with Run now with different parameters, or in the run-now request. Tasks reference them with dynamic value references, like job dot parameters dot region, inside double curly braces. When a job parameter and a task parameter share a key, the job parameter wins. A task can also pass a result to later tasks as a task value: a notebook sets it with dbutils.jobs.taskValues.set, and later tasks read it with a reference to the values of that task. Task values carry small results, like a row count or a flag, never the data itself.

If/else conditions

An If/else condition task compares two operands, and runs one branch or the other. An operand can be a job parameter, a task value, or a fixed value, and the operators include equal, not equal, greater than, and less than. Equal and not equal compare strings, so twelve point zero is not equal to twelve, while greater than and less than compare numbers. Tasks that depend on the condition run on its true outcome, or on its false outcome. And for error paths, the Run if setting of a task, like All done or At least one failed, starts a cleanup or an alert after failures.

For each loops

A For each task runs a nested task once for each item of a JSON array, like twelve region codes, given directly, or through a job parameter or a task value from an earlier task. Inside the nested task, the input reference holds the current item, or one of its fields, so one notebook processes every region. Concurrency sets how many iterations run at the same time: it is one by default, so raise it to process regions in parallel. A For each task cannot contain another For each task. And the run history of a For each task is a table of its iterations, each with its own status, so a failed region is easy to find.

Recap

Let's recap. Lakeflow Jobs can be created in the UI, with the Jobs API, with the CLI, or with the Python SDK, and bundles keep their definitions in Git. In the CLI, run-now starts a run, reset overwrites all the settings, update changes some, and submit runs once without a job. Job parameters reach every task and win over task parameters with the same key, while task values pass small results between tasks. If/else conditions run one branch or the other, and equal and not equal compare strings. And For each runs a nested task for each item of a list, one at a time by default.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. A release script must change only the schedule of an existing job, and keep all its other settings as they are. Which CLI command fits?

    • databricks jobs reset
    • databricks jobs create
    • databricks jobs update
    • databricks jobs submit
    Show the answer

    databricks jobs update

    Jobs update changes only the settings that it receives, and keeps the others. “databricks jobs reset” would overwrite all the settings of the job with the new JSON. “databricks jobs create” would create a second job, with its own ID. And “databricks jobs submit” would start a one time run, without changing the job at all.

  2. A condition task compares the task value total_amount, which is 12.0, with the value 12, using the == operator, and the true branch never runs. Why?

    • Task values cannot be used in conditions
    • The condition needs a For each task
    • A job parameter overrides the task value
    • == compares the two values as strings
    Show the answer

    == compares the two values as strings

    Equal and not equal compare strings, so twelve point zero and twelve are different, while greater than and less than compare numbers. “Task values cannot be used in conditions” is wrong, since a task value is a valid operand. “The condition needs a For each task” has nothing to do with comparing two values. And “A job parameter overrides the task value” is wrong, since no job parameter is involved here.

  3. A job must run the same cleaning notebook for each of the twelve regions that an earlier SQL task lists, with up to four regions at a time. What should the data engineer configure?

    • Twelve notebook tasks, one per region
    • A For each task with concurrency 4
    • An If/else task for each region
    • Twelve jobs started with run-now
    Show the answer

    A For each task with concurrency 4

    A For each task takes the list of regions from the earlier task, runs the notebook once per region, and runs four at a time. “Twelve notebook tasks, one per region” would copy the same task twelve times, and break when a region is added. “An If/else task for each region” would only choose between two branches, and runs nothing in a loop. And “Twelve jobs started with run-now” would create twelve separate runs to track, instead of one job.