Skip to main content

Run a workflow

This recipe triggers a Databricks Workflows job using the Databricks SDK for Python.

Code snippet

app.py
from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

job_id = "921773893211960"
parameters = {"param1": "value1", "param2": "value2"}

try:
run = w.jobs.run_now(job_id=job_id, job_parameters=parameters)
print(f"Started run with ID {run.run_id}")
except Exception as e:
print(f"Error: {e}")

Resources

Permissions

Your app service principal needs the following permissions:

  • CAN MANAGE RUN permission on the job

See Control access to a job for more information.

Dependencies

requirements.txt
databricks-sdk
dash