Databricks asset bundles passing parameters using bundle run which are not declared
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 09:59 PM
Hi,
We recently decided to move to databricks asset bundles, one scenario that we are dealing with is we have different parameters passed to the same job which are handled in the notebook. With bundles when I try to pass parameters at runtime(which are not declared anywhere) it throws error saying "variable not defined". I am using cli to call bundle run and trying to pass parameters using --var="<varname=value>". Is there anyway to pass ad-hoc parameters to bundle run like we could with api's?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 07:27 AM
Found out we can do it using --params=<comma sep key=value pairs>
However, job needs to have at least 1 param defined to accept parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 06:12 AM
@ashish577 Just an extension to this, can I deploy a job (not run) with different parameter values ?
something like databricks bundle deploy --params k=v
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 08:38 AM
Following syntax can be used.
databricks bundle run -t ENV --params Param1=Value1,Param2=Value2 Job_Name
Job Definition Parameter may look like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 01:50 PM
When I implemented the above with three params, I received an error:
`Error: no such resource: Param2=Value2,`
I found that adding quotes to the syntax did work:
databricks bundle run --params "param1=value1, param2=value2, param3=value3" job
Hope that helps!

