Hello everybody,
I am using MariaDB and Grafana to keep track of weekly consumption totals, but Grafana does not recognize this date format “DATE_FORMAT(`Timestamp`, ‘%Y-%u’) AS Week” as a time field. Any suggestions? The query is successful on MariaDB.
Other failed SQL alternatives
- DATE_ADD(DATE_FORMAT(`Timestamp`, “%Y-%m-%d 00:00:00”), INTERVAL(-WEEKDAY(DATE_FORMAT(`Timestamp`, “%Y-%m-%d 00:00:00”))) DAY)
- WEEKOFYEAR(`Timestamp`) AS Week
- YEARWEEK(`Timestamp`) AS Week
Other failed Grafana alternatives
- Format time transformation
- An XY Chart, but the “Week” field is not available for selection.
Thank you in advance.
for your query time-stamp not formated as a time series
use this query it will provide you correct format of time series so you can use timeseries panel visualization.
1 Like
Thank you, Sir. Indeed, I suspected that the format might be the cause and I even read about STRING_TO_DATE, but I didn’t dig deep enough.
It is not ideal, because the format of the original query would be way better for visualization, but I guess that is where Grafana is as of today.
Especially, the fact that the error message goes “Data is missing a time field” instead of “Incorrect time field format” is confusing.
Thanks again
@infofcc3 Do you want to answer it on the crosspost on Stack Exchange too? I will give you the credit.
1 Like
Welcome, Thanks for your feedback.
1 Like