Databricks CLI how to start a job and pass the parameters?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 11:15 AM
I try to start a job ID 85218616788189 and pass one parameters 'demo' in Windows Shell.
This works:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 12:53 PM
Hi Jim, I think the right syntax would be something like this:
databricks jobs run-now --job-id 85218616788189 --notebook-params '{"demo":"parameter successful"}'.
Let me know if that worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 12:39 PM
Thanks for your help. I think this syntax only works for Databricks CLI (Legacy). I am using the new CLI which doesn't support the syntax.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 02:09 AM - edited 07-11-2024 03:50 AM
@jim12321 I got the same error with CLI version 0.223.1, but I could resolve it by escaping the quotation marks:
databricks jobs run-now --json '{\"job_id\":85218616788189,\"notebook_params\": {\"demo\":\"parameter successful\"}}'
Seems to be fixed by the databricks team with version 0.223.2 and using CLI version 0.208 your provided command works fine too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
If the job itself has parameters you have to use 'job_parameters' instead. No need for escaping as of version 0.243.0
databricks jobs run-now --json '{"job_id": <JOB_ID>, "job_parameters": {"will_exit": "yes"}}'

