CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 1 · Lesson 5/46

    Automate Lakeflow Jobs with the Databricks CLI, SDK and REST API

    Create and automate ETL workloads using Lakeflow Jobs via the UI, API, and CLI.

    10 min read
    1.92% of exam
    3 sources
    Published 2 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Choose between the Databricks CLI, SDKs, REST API and Declarative Automation Bundles for job automation
    • Create, inspect and manage jobs and runs with the databricks jobs command group
    • Distinguish scheduled runs, run-now and runs submit, and what each one means for visibility and auto-optimization
    • Recognise the workspace limits that shape automated job creation

    1.Choosing a tool for programmatic jobs

    Anything you can build in the Jobs UI you can also create and run with developer tools. The documentation compares three of them for creating and managing jobs directly. It also points to a fourth group for jobs that live in a CI/CD pipeline.

    Developer tools for Lakeflow Jobs and when each is meant to be used
    ToolWhat it isTypical use
    Databricks CLIA command-line interface that wraps the REST APIOne-off tasks, experimentation, shell scripting
    Databricks SDKs (Python, Java, Go, R)Language libraries for calling DatabricksApplications and custom workflows, instead of sending raw curl calls
    Databricks REST APIThe underlying HTTP API, for example /api/2.2/jobs/getAutomation where no SDK exists for your language
    Declarative Automation Bundles / Terraform providerInfrastructure-as-code definitions of jobsManaging jobs as part of CI/CD

    Checkpoint 1 of 7· Check yourself

    A platform team wants every change to its ETL job definitions reviewed in Git and deployed through CI/CD. Which approach does Databricks point them to?

    Between the direct tools, Databricks recommends the CLI and an SDK. Calling the REST API directly is the fallback for languages that have no Databricks SDK. The tools are not separate systems. The CLI wraps the REST API, so most CLI commands map to a single REST request.

    Sources1

    2.The databricks jobs command group

    The CLI is organised into command groups, and jobs is the group for jobs and job runs. Use databricks jobs -h, or -h after any command, to see its syntax. Because the CLI wraps the REST API, databricks jobs get is a GET to /api/2.2/jobs/get. To create a job, describe it in JSON and pass the file with --json @<file-path>. You don't have to write that JSON from scratch. The job page in the UI shows the JSON of any existing job.

    Minimal job definition: one notebook taskjson
    { "name": "My hello notebook job", "tasks": [ { "task_key": "my_hello_notebook_task", "notebook_task": { "notebook_path": "/Workspace/Users/someone@example.com/hello", "source": "WORKSPACE" } } ]}

    Checkpoint 2 of 7· Fill the gap

    Which command saves the job definition above as a new job?

    databricks jobs  ?  --json @<file-path>

    The group also covers runs. get-run RUN_ID returns a run's metadata. --include-history adds the repair history, and --include-resolved-values adds the resolved parameter values. jobs get and get-run page large arrays. Only the first 100 elements of arrays such as tasks and job_clusters come back, and you pass next_page_token as --page-token to get the rest. cancel-run and cancel-all-runs both work asynchronously. delete-run only works on runs that are no longer active.

    Checkpoint 3 of 7· Check yourself

    A script runs databricks jobs cancel-all-runs --job-id 123 and then immediately assumes that no run of job 123 can be active. Why is that assumption unsafe?

    Checkpoint 4 of 7· Exam question

    An engineer builds a Lakeflow Job with a `For each` task whose input is a JSON array of ingestion source paths, for example `["s3://raw/orders/", "s3://raw/customers/", "s3://raw/products/"]`. The nested task is a notebook task that reads the source path from a task parameter. How should that parameter be configured so each loop iteration processes its own array element?

    Sources12

    3.Three ways to run: schedule, run-now and submit

    The CLI and the API give you the same three ways to run a job. First, if the JSON definition includes a schedule, the job runs automatically on that Quartz cron schedule.

    A schedule block in a job definitionjson
    "schedule": { "quartz_cron_expression": "46 0 9 * * ?", "timezone_id": "America/Los_Angeles", "pause_status": "UNPAUSED"},"max_concurrent_runs": 1,

    Second, run-now (the CLI's databricks jobs run-now, or jobs.run_now in the API) starts a run of a job that already exists. Third, submit (databricks jobs submit, or jobs.runs.submit in the API) takes a full job definition and runs it once. No job is saved, so nothing appears in the UI, and when the run finishes the job no longer exists. This has a cost on serverless. Because the job isn't saved, a failed submitted job can't be auto-optimized for serverless compute. The docs suggest classic compute for those runs, or using create and then run-now.

    Checkpoint 5 of 7· Match them up

    Match each way of running a job to its behaviour

    Tap a term, then the definition that fits it.

    Sources1

    4.The Python SDK, raw REST calls and workspace limits

    The Python SDK works from a notebook or a local machine. On Databricks Runtime 12.2 LTS and below, you have to install it first. The docs build a JobSettings object from the same dictionary shape as the CLI JSON, then pass it to jobs.create on a WorkspaceClient:

    Creating a job with the Databricks SDK for Pythonpython
    w = WorkspaceClient()
    j = w.jobs.create(**test_sdk.as_shallow_dict())

    With no SDK, you call the REST API directly. The docs' example reads the workspace host and a personal access token from environment variables and sends a bearer-token request to the versioned Jobs endpoint:

    Getting job details with a direct REST callbash
    $ curl --request GET "https://${DATABRICKS_HOST}/api/2.2/jobs/get" \
         --header "Authorization: Bearer ${DATABRICKS_TOKEN}" \
         --data '{ "job": "11223344" }'

    Automation also runs into limits that a person clicking in the UI rarely reaches. A workspace can have at most 2000 concurrent task runs. A run that can't start immediately gets 429 Too Many Requests. A workspace can create at most 10000 jobs per hour, and runs submit counts toward that limit, as do jobs created through the REST API. A workspace can hold up to 12000 saved jobs, and a job can have up to 1000 tasks.

    Checkpoint 6 of 7· Check yourself

    A test harness calls runs submit thousands of times an hour and occasionally receives HTTP 429. What does the 429 indicate?

    Checkpoint 7 of 7· Exam question

    A platform team wants to automate the creation and updates of Lakeflow Jobs from a CI/CD pipeline instead of configuring jobs by hand in the Jobs UI. Which of the following are valid, currently supported ways to do this? (Choose all that apply.)(Select 3)

    Sources3

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Runs started with jobs submit / runs submit appear as saved jobs and get the same serverless auto-optimization as other jobs.Why is that wrong?

      Submitted jobs are not saved and are not visible in the UI. Because they aren't saved, they can't be auto-optimized for serverless compute when they fail.

      Covered in Three ways to run: schedule, run-now and submit

    2. 2.The CLI is a separate interface with capabilities beyond the REST API.Why is that wrong?

      The CLI wraps the REST API, and most CLI commands map to a single REST request.

      Covered in Choosing a tool for programmatic jobs

    Practise it for real

    Create, run and inspect a one-task notebook job entirely from the Databricks CLI

    1. 1.Save the minimal job JSON (name "My hello notebook job", one notebook_task) to a file, with notebook_path pointing to a notebook you own.

      Why: jobs create takes its request body from a JSON file passed with --json @<file-path>.

      You should see: A valid JSON file containing a name and a tasks array with one task_key.

    2. 2.Run databricks jobs create --json @<file-path>.

      Why: This saves the job, so it can be run again with run-now and appears in the Jobs & Pipelines UI.

      You should see: The command returns the new job_id, and the job appears in the jobs list.

    3. 3.Run databricks jobs run-now with that job ID.

      Why: run-now triggers a run of a job that already exists.

      You should see: A run starts and shows up in the job's run history.

    4. 4.Run databricks jobs get <job-id>.

      Why: Confirms the saved definition, including defaults such as max_concurrent_runs and run_if.

      You should see: JSON with job_id, creator_user_name and a settings object containing your task.

    Stuck? Get a nudge

    If you're unsure of a command's flags, add -h, for example databricks jobs run-now -h.

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Databricks recommends using the Databricks CLI and a Databricks SDK”
      ↩︎ Choosing a tool for programmatic jobs
      “For example, databricks jobs get maps to GET/api/2.2/jobs/get.”
      ↩︎ The databricks jobs command group
      “The jobs.runs.submit API takes a job definition and triggers a run for the job.”
      ↩︎ Three ways to run: schedule, run-now and submit
      “submitted jobs can't be auto-optimized for serverless compute in case of failure”
      ↩︎ Exam trap 1
      “For example, databricks jobs get maps to GET/api/2.2/jobs/get.”
      ↩︎ Exam trap 2
      “To programmatically manage jobs as part of CI/CD, use Declarative Automation Bundles or the Databricks Terraform provider.”
      ↩︎ Checkpoint
      “With submit, the job is not saved, and isn't visible in the UI.”
      ↩︎ Prediction
      “submitted jobs can't be auto-optimized for serverless compute in case of failure”
      ↩︎ Checkpoint
    2. 2.
      “Delete a non-active run. Returns an error if the run is active.”
      ↩︎ The databricks jobs command group
      “The runs are canceled asynchronously, so it doesn't prevent new runs from being started.”
      ↩︎ Checkpoint
    3. 3.
      “A workspace is limited to 2000 concurrent task runs.”
      ↩︎ The Python SDK, raw REST calls and workspace limits
      “The number of jobs a workspace can create in an hour is limited to 10000”
      ↩︎ The Python SDK, raw REST calls and workspace limits
      “A 429 Too Many Requests response is returned when you request a run that cannot start immediately.”
      ↩︎ Checkpoint

    Spotted a mistake, or was something unclear? Tell us.