I’m trying to embed a variable in a SQL query, but I need the query as a string.
So I need, when selecting all values, instead of getting:
‘a’,‘b’,‘c’
I need two singe quotes:
‘‘a’’,‘‘bb’’,‘‘c’’
I have been looking at the formatting options, but even when I try to use the double quotes SQL/Grafana interprets them a bit different, where two single quotes together has a space between them, but the doulbequote option has them adjacent and the interpreter doesn’t like it
If you re-read the original post, they need the query inside of a string. There’s a variety of good reasons for needing a query in a SQL string, such as passing that to EXEC, as a stored function argument, etc.
The two-single-quotes is the way to escape a single quote within a string (which needs to be wrapped with single quotes, not double). As far as I’ve been able to figure out, there’s no way in Grafana currently to get a multi-variable’s values as a comma-separated list of double-single-quoted values.
An option like ${dashboard_variable:doublesinglequote} that returned ''val1'',''val2'',''val3'' would be immensely helpful and seems trivial to add.