I have multiple tables in a MySQL DB which I have successfully configured as a variable in Grafana. Within all of these tables are multiple data fields, including a field called ‘source’. Across the multiple tables there are approx a total of 12 possible values of source. In any given table there can be a single source or many sources. In my display template, I want each source within a table to be a unique time series. The only way I can figure out how to do this is to hard wire 12 queries, each with a WHERE clause for each possible source value. Grafana will plot each time series if there is data, otherwise it is omitted. This is the end result I want, but I’m wondering if there is a way to somehow nest queries or a way to utilize a variable (without it being a pull down choice) to automatically only do as many queries as there are unique source values for a given table. The other reason I’d want to do that is because I can configure the queries to specific source values, but if a new source value is inserted into the DB, the Grafana display wouldn’t grab that data until a new query be manually added.
And maybe what I describe just isn’t possible? I do not want to move ‘source’ into the table name, so that’s not an option?
The advantage is I am in the development stages, so I have flexibility between changing display end and the DB end.
Thanks in advance!