- What Grafana version and what operating system are you using?
Grafana v11.2.0 - What are you trying to achieve?
I need to join the results of queries A, B, and C using SQL operators in an expression. - How are you trying to achieve it?
I added queries A, B, and C, and wrote the following SQL expression:
“SELECT * FROM A
JOIN B ON A.serialnumber = B.serialnumber
JOIN C ON A.devicename = C.devicename;” - What happened?
When I run the query, I get the following error:status: 500 statusText: "Internal Server Error" data: Object message: "Query data error" traceID: "" config: Object url: "api/ds/query?ds_type=__expr__&expression=true&requestId=Q124" method: "POST" data: Object requestId: "Q124" hideFromInspector: false headers: Object retry: 0 traceId: undefined message: "Query error: 500 Internal Server Error"
- What did you expect to happen?
I expected to get the joined results of queries A, B, and C in a table. - Can you copy/paste the configuration(s) that you are having problems with?
I used the following environment variables to create the SQL expression:
GF_FEATURE_TOGGLES_ENABLE=transformationsVariableSupport,sqlExpressions
I’m sorry to hear that you’re experiencing difficulties.
Grafana can provide valuable information about certain issues through its own debug logs. These logs can help troubleshoot and identify the root cause of problems (especially if they are related to anything that can be configured via Grafana config file).
To enable debug logging edit the configuration file grafana.ini
:
[log]
# Either "console", "file", "syslog". Default is console and file
# Use space to separate multiple modes, e.g. "console file"
mode = console file
# Either "debug", "info", "warn", "error", "critical", default is "info"
level = debug
Then restart grafana for the setting to go into effect.
Replicate the problem and check Grafana logs. However, before posting the debug logs on the community forum, it is important to sanitize any private details such as passwords, tokens, IPs, names, … By including properly formatted debug logs (with sanitized information) and details about your installations (e.g. exact Grafana version, how it was installed, OS details, …), you greatly enhance the chances of receiving accurate assistance and solutions.
Are the tables in each query on separate sql servers? Or on same server different databases?
Two tables are from the same SQL Server but different databases, while the other one is from InfluxDB on a different server.
This is what I’m trying to do:
What does it show when you hover over the error icon?
Also what happens if for now for testing purposes you only select from A
Select A.*......
And the rest of the joins
I’m still encountering the same Internal Server Error that I mentioned earlier. I tried running the query for only table A, but the error persists as shown below.
how about select * from $A LIMIT 1
Also look into this
I checked the link you provided, but the issue is still not resolved.
I have checked the logs, and it shows that there is no such file or directory for DuckDB. Can you guide me on how to install the DuckDB plugin and provide the appropriate link to download it?
I can’t. I would say that you should to understand how it works under the hood when you use experimental/undocumented feature (you should be able to read/understand source code).
Keep in mind security - Grafana SQL Expressions allow for remote code execution | Grafana Labs