How to connect mysql with grafana without having timestamp field in table(mysql)? Is this possible?


I am new to grafana i have been doing some examples in grafana by adding timestamp field in mysql table, but now i have bulk of data in mysql without having time field in it, how i can import that data in to grafana? i am not getting any idea which tool should be used .

can any one help me out

how i can import that data in to grafana?

You can’t import any data to Grafana. Grafana is only a visualization tool that integrates against other databases for retrieving the data.

To be able to use graph, pie chart panel you’ll need to write a query in such that it returns a timestamp.

Currently, the mysql database we are working do not have timestamp it has hour(tiny int) and minute(tiny int) field by concating those fields we are writing custom query to generate timestamp …will that custom query makes any difference if you use like that in future? does all the features in Grafana will support if we write custom query ??

How are you planning to visualize that kind of data if you haven’t the concept of year/month/day? Or is it hours and minutes since 1st January 1970? Would help a lot if you could include some information of how you’re planning to visualize your data, what panel types and so on. Thanks

You can use Table without timestamp:

FROM database

You can use circle with example NOW() date value.

Currently the table we are working have individual fields for hour,minute and second.
So,i’m using custom query to get timestamp

SELECT UNIX_TIMESTAMP(concat(CURDATE()," “,Hour,”:“Minute,”:",“Second”))as time_sec,field_name as value ,‘series’ as metric from table_name

the above query is returning the unix_timestamp using which we are able to plot the graph.
By using custom query does it effect the performance of Grafana and will there be any change in any other section as we are retrieving the value of a timestamp from a query in spite of table_column .

Not Grafana performance per se, but probably not optimal performance of executing the queries in your MySQL database since having a single column with an index would probably outperform your timestamp conversion

Thank you for the information :+1: :grinning: