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
04-01-2022 05:26 AM
Hi @Sudeshna Bhakat , It Looks like @Bilal Aslam 's answer helped you get the correct answer. Would you like to mark it as the best answer as it would help the entire community in the hereafter? Thanks for such a great question.
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.