You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What would you like to be added:
I would like to have a Variable Formatting Option which force the values to be quoted.
My favorite is to have single quote.
For instance, I tried to get a string like 'test.1', 'test2' on the play site but I failed.
Why is this needed:
One of my field keys, contain a InfluxDB keyword and I would like to specify which field keys I would like to display, with an variable.
Example:
The variable ($fields) is populated with: SHOW FIELD KEYS FROM my_table
Then I would like to use it like: SELECT ${fields:singlequoted} FROM my_table WHERE ...
Problem:
My problem is, that one of the KEYS is called user@blafooo. This result with SELECT ${fields:csv} FROM ... into an DB error like:
error parsing query: found USER, expected identifier, string, number, bool at line 1, char 8
Thanks in Advance
Clemens
The text was updated successfully, but these errors were encountered:
cfconrad
changed the title
Variable Formatting Options to enforce quotes on each value
Introduce Variable Formatting Options to enforce quotes on each value
Oct 25, 2019
Singlequote
Formats single- and multi-valued variables into a comma-separated string, escapes ' in each value by \' and quotes each value with '.
servers = ['test1', 'test2']
String to interpolate: '${servers:singlequote}'
Interpolation result: "'test1','test2'"
Doublequote
Formats single- and multi-valued variables into a comma-separated string, escapes " in each value by \" and quotes each value with ".
servers = ['test1', 'test2']
String to interpolate: '${servers:doublequote}'
Interpolation result: '"test1","test2"'
If anyone is landing here and wondering, as of Grafana v6.7.2 this is not yet working.
Meaning the docs incorrectly already mention Singlequote, Doublequote, Sqlstring,
What would you like to be added:
I would like to have a Variable Formatting Option which force the values to be quoted.
My favorite is to have single quote.
For instance, I tried to get a string like
'test.1', 'test2'
on the play site but I failed.Why is this needed:
One of my field keys, contain a InfluxDB keyword and I would like to specify which field keys I would like to display, with an variable.
Example:
The variable (
$fields
) is populated with:SHOW FIELD KEYS FROM my_table
Then I would like to use it like:
SELECT ${fields:singlequoted} FROM my_table WHERE ...
Problem:
My problem is, that one of the KEYS is called
user@blafooo
. This result withSELECT ${fields:csv} FROM ...
into an DB error like:Thanks in Advance
Clemens
The text was updated successfully, but these errors were encountered: