questdb / grafana-questdb-datasource

Questdb datasource plugin for Grafana.
Apache License 2.0
9 stars 0 forks source link

Using Grafana variable in the Query Builder does not include quotes #106

Closed jsaathof closed 4 months ago

jsaathof commented 5 months ago

To reproduce

  1. create a variable in the dashboard with a query.
  2. use the variable in a filter ( ${variable} )
  3. the SQL preview shows the variable is not quoted. Running the query will result in the error: "error querying the database: pq: Invalid column: "

This happens in the Query Builder. When adding a static value in the filter single quotes are added. When using a variable (in my case ${selected_hostname}) won't add quotes which makes QuestDB interpret this as a reference to a column. This, of course, does not work.

I can fix this in the SQL Editor but I want to use the Query Builder. I guess a solution would be adding quotes to all values after the "=" sign (and probably all options). This is done when using a simple string. I cannot think of a use case when no quotes are required.

I tried adding quoted in the field but that gets quotes added again ( -> ''${variable}'' ). So that is also not a work-around.

With the Query Builder an error is thrown:

Screenshot 2024-06-22 at 16 18 25

When adding quotes in the SQL Editor the query works:

Screenshot 2024-06-22 at 16 19 10

QuestDB version:

8.0.1

Grafana version:

11.0.0

Plugin version:

0.1.3

OS, in case of Docker specify Docker and the Host OS:

OpenSUSE Leap 15.5

Full Name:

Jurriaan Saathof

Affiliation:

none

Have you followed Linux, MacOs kernel configuration steps to increase Maximum open files and Maximum virtual memory areas limit?

Additional context

No response