cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Databricks CLI how to start a job and pass the parameters?

jim12321
New Contributor II

I try to start a job ID 85218616788189 and pass one parameters 'demo' in Windows Shell.

This works:

databricks jobs run-now 85218616788189 
 
If I try this one,
databricks jobs run-now --json '{"job_id":85218616788189,"notebook_params": {"demo":"parameter successful"}}'
jim12321_0-1710267172994.png
 
What is the right syntax? 
@CLI
 

 

4 REPLIES 4

Sravani-Vadali
Databricks Employee
Databricks Employee

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!

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.

https://docs.databricks.com/en/dev-tools/cli/commands.html

Husky
New Contributor III

@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.

JaviRuiz
New Contributor II

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"}}'

 

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now