Can't access MySQL Table using a name with spaces

Hi all,

just installed Grafana to plot AMR (Automated Meter Reading) Energy Consumption graphs.

My Problem is Tables inside the DB’s are being created automatically and some of those have a history of more than five years. So there’s no easy way of just changing those name’s.

In plain SQL I simply use `` or ‘’ to protect the spaces inside my Query. In Grafana that doesn’t seem to work.

So please give me a hint on how to read from Tables like: WSE_KA-SGN_UV Theke

Try specifying the query using Text Edit mode where you enter the query manually, and put backticks round the table name (not single or double quotes).

1 Like

Should have been posting an example:

SELECT 
FROM_UNIXTIME(TIMESTAMP) AS time_sec,
    value - lag(value, 1) OVER (ORDER BY from_unixtime(TIMESTAMP)) AS OG-Rechts
FROM `WSE_KA-SGN_OG Rechts`
ORDER BY time_sec ASC

I also tried ‘’ … but in both cases I get this Failure:

Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘-Rechts
FROM WSE_KA-SGN_OG Rechts
ORDER BY time_sec ASC’ at line 3

Sorry, I don’t know. I suggest submitting an issue on github as this does look like a deficiency in the s/w.

Argghh, after double checking once more I realized/saw that the Failure wasn’t within the Backticks but with the dash I used a line above… :frowning: