Open davidraker opened 6 years ago
On further investigation, I did find that this works as a workaround:
WHERE column_name = $variable || '/string'
This seems to be contrary to the Grafana documentation on how this should work, however.
Hello,
I had the same sort of issue trying to use a variable in a WHERE clause in the metrics interface
WHERE column_name like $variable
or
WHERE column_name like [[variable]]
is translated in the query as :
WHERE column_name like ''<variable value>''
the 2 single quotes surround,
results in an sql error...
I manage to workaround the problem by adding '' ||
before $variable
to have:
WHERE column_name like
'' || $variable
in the metrics interface avoid the issue in the query:
SELECT ... WHERE ... AND column_name like '' || '<variable value>' GROUP...
which success and behave as wanted too ;O)
Hope it will help, before the issue can be fixed.
Hi hi :)
Thanks a lot for your input! With our latest effort, the PostgreSQL implementation of Grafana works fine with CrateDB. Hence, we skip the Grafana Datasource Plugin for CrateDB and move over to the PostgreSQL data source. In case you wanna read more about how to pair CrateDB and Grafana, please take a look at this blog post of ours.
Best, Stephanie
Attempting to use a variable in the WHERE clause as:
WHERE column_name = $variable/string
orWHERE column_name = [[variable]]/string
For variable contents: "foo" this should expand to'foo/string'
. Instead it expands to'foo'/string
. Similar behavior seems to have been discussed for the MySQL and PostgreSQL (https://github.com/grafana/grafana/pull/9611) but this still seems to be a problem for the Crate datasource.