โ03-15-2022 11:49 AM
I was trying to create a variable and i got the following error -
command -
SET a = 5;
Error -
Error running query
Configuration a is not available.
โ03-20-2022 01:35 AM
@Sudeshna Bhakatโ what @Joseph Kambourakisโ described works on clusters but is restricted on Databricks SQL endpoints i.e. only a limited number of SET commands are allowed. I suggest you explore the curly-braces (e.g. {{ my_variable }}) in Databricks SQL.
โ03-16-2022 09:42 AM
Hello @Sudeshna Bhakatโ
Thank you for posting on Databricks Community Forum
Could you please use Dashboard filters
https://docs.databricks.com/sql/user/queries/query-filters.html
Query
SELECT l_linenumber AS linenumber, COUNT(*) AS cnt FROM lineitem WHERE l_linenumber = {{var}}
GROUP BY l_linenumber
Query editor looks like below
When you add this query to the dashboard, the var looks like below
Dashboard
Please let us know if this works for you.
I have filed a feature request internally to support this.
โ03-17-2022 05:25 AM
Here is an example of the syntax:
set a.variablename = value
Then to use it you need to reference it with ${a.variablename}. See the screenshot
โ03-20-2022 01:35 AM
@Sudeshna Bhakatโ what @Joseph Kambourakisโ described works on clusters but is restricted on Databricks SQL endpoints i.e. only a limited number of SET commands are allowed. I suggest you explore the curly-braces (e.g. {{ my_variable }}) in Databricks SQL.
โ03-21-2022 03:18 AM
Using curly braces means it will create parameters. but i don't need a parameter. There is no way other than creating a parameter?
โ03-21-2022 03:39 AM
No, not yet. For now, you can only use SET commands to set a limited number of configuration options.
โ03-21-2022 03:41 AM
Got your point. Thank you very much for the help
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group