cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How do we pass parameters which have a "," with bundle run ?

ashish577
New Contributor III

So I have a query "select col1, col2 from table" that I need to pass as a parameter to a databricks job that I am triggering through the bundle run command. Issue is, when I pass this via --params="query=select col1, col2 from table" it splits it based on the comma. Any way to pass this entire query as a single parameter ?

1 REPLY 1

Kaniz
Community Manager
Community Manager

Hi @ashish577 , When passing a query as a parameter to a Databricks job using the bundle run command, you can avoid the issue of it being split based on the comma.

Here are a couple of approaches you can consider:

  1. Environment Variables:

    • You can pass the query as an environment variable with a specific name. For example:
      BUNDLE_VAR_QUERY="select col1, col2 from table"
      
    • Then, when invoking the bundle run command, reference the environment variable:
      databricks bundle run --var="QUERY=$BUNDLE_VAR_QUERY"
      
  2. Command-Line Argument:

    • Pass the query directly as a command-line argument using the --var flag:
      databricks bundle run --var="query=select col1, col2 from table"
      
Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.