MySQL persistence & Grafana

Tags: #<Tag:0x00007f616d86bd90> #<Tag:0x00007f616d86b9d0> #<Tag:0x00007f616d86b110>

I have searched for a snippet of SQL that will allow Grafana to graph multiple items dynamically. But I am not finding a solution that is to my liking.

I have persistence running and logging to MySQL.
Here’s how I see the MySQL binding working:
There is a table (Items) that has a list of OH item names and a corresponding numbers. This number corresponds to a separate DB table (e.g., “2” corresponds to “Item2” table).
There are tables for each item. Each table has two columns, a time stamp and a value.

So I am trying to craft a SQL statement that will select all of the Item names that have “Temp” in them and then select from each named table the data points for Grafana.

I know that in Grafana I could manually add queries for each Item table and it will work; I am looking for a more dynamic query so that when I add more sensors they just appear in the graph.

Has anyone done this?

Or is there another MySQL binding that would create one table with columns for Item, timestamp, value.

Thanks in advance

You will probably have better luck asking this on a Grafana forum since it doesn’t really have anything to do with OH itself.

Based on my limited experience using Grafana I don’t think this is possible because Grafana needs more than just the SQL query to create the chart.

Thanks for the reply. I’ll try that.