Update: I was able to fix this issue by changing the column names in the database table from series-A, series-B to A and B respectively.
It might be a good idea to alert new users to the pickiness of the query builder regarding field names in the data. Apparently the hyphen in the name confuses it.
-
What Grafana version and what operating system are you using?
MacOS Grafana v8.1.3 -
What are you trying to achieve?
display a simple graph from a table in MariaDb (mysql) -
How are you trying to achieve it?
1 Adding the data source OK
2 Create a new dashboard OK
3 add empty panel OK
edit query NOT OK -
What happened?
When editing the query with the query editor various errors are displayed -
What did you expect to happen?
The graph to be displayed -
Can you copy/paste the configuration(s) that you are having problems with?
No -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
The table I want to graph is a simple table with 4 fields:
+----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+----------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| time | datetime | YES | | NULL | |
| series-A | float | YES | | NULL | |
| series-B | float | YES | | NULL | |
+----------+------------------+------+-----+---------+----------------+
incidentally: this table was populated by exporting the random walk twice, and combining the two csv files in a text editor. The resulting file was imported into the MariaDb table.
When I add an empty panel to a new dashboard, the query builder has the following pre-selected:
From: testdata (the table name)
Time column: time
Metric column: none
Select: Column: id
Where: Macro: $__timeFilter
Format as: Time series
The graph area shows a graph of a straight line rising from left to right (I assume it’s graphing the id value).
When I click on the plus icon next to “Column: id” and choose “Column” this adds a second column id. I Click on the second column and change it to “series-A”.
The result: the graph now displays: “Data does not have a time field” and an alert icon top-left.
When I edit the sql (click the button “edit sql”) to read:
SELECT
time AS “time”,
series-A,
series-B
FROM testdata
ORDER BY time
Nothing changes.