Gauge with MySQL: cannot convert timestamp from db

Hi, after updating Grafana from v7 to v8, my dash visualization stopped working. I matched that after v8 grafana changed time-based query syntax.
My previous query:

SELECT DATE_FORMAT(mydate,"%d %m %Y") AS "time",  sum(energy) AS metric FROM zabbix.consumptions 
where host_name="StoykaMain" 
group by mydate order by mydate desc

But it shows an error:db convert time column failed: column type "[]*string" is not convertible to time.Time

I’ve tried to resolve and I’ve got this query:

SELECT mydate*1 AS time,  sum(energy) AS metric FROM zabbix.consumptions 
where host_name="StoykaMain" 
group by mydate order by mydate desc

And it shows this:

So, how can I set the time correctly and show the graph?

Hi @atonik

A question: What datasource are you using?

I would check out this related thread that discusses the changes to SQL datasources and how to fix a broken query for v8:

I’m using Zabbix MySQL

1 Like

Hi,

I’d start here with this note about SQL datasources in Grafana 8:

:+1:

This topic was automatically closed after 365 days. New replies are no longer allowed.