skip to Main Content

I recently encounter an issue with legacy dbx databricks cli installed via pip when running below command somehow the notebook parameters passed in environment variable is not picking up.
databricks jobs run-now --job-id '$db_id' --notebook-params '$db_job_np' --version "2.1"

Error: Error: JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Found that databricks retired the legacy CLI and I currently migrated to this CLI but wondering how to pass the notebook parameters in the latest Databricks CLI.

Any help on this would be great.

2

Answers


  1. How to pass the notebook parameters in the latest Databricks CLI: –

    In the latest Databricks CLI, you can provide --notebook-params with key values as shown in the below format.

    databricks jobs run-now --job-id '256794483973904' --notebook-params '{"key1": "value1"}'
    

    enter image description here

    enter image description here

    Or else create a .Json file with the required parameters and provide the parameter file path with --notebook-params argument.

    Sample.json:

    { 
        "key1": "xxx", 
        "key2": "xxx"
    }
    
    databricks jobs run-now --job-id '256794483973904' --notebook-params Sample.json
    
    Login or Signup to reply.
  2. it can be achieved using below

    Syntax:

    databricks jobs run-now --json '{  
     "job_id":<job-ID>,
     "notebook_params": {
     <key>:<value>,
     <key>:<value>
     }
    }'
    

    Usage (Example):

    databricks jobs run-now --json '{  
     "job_id":123,
     "notebook_params": {
     "key1":"value1",
     "key2":"value2"
     }
    }'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search