Grafana MySQL Query Variable

Hi There

I am exploring Query variables with MySQL, reference:
http://docs.grafana.org/features/datasources/mysql/

Are query variables allowed as a wildcard to replace “Table Name” within a SQL query.

Example:

Original Query:
SELECT event_name FROM event_log WHERE $__timeFilter(time_column)

Potential Query:
variable _TableName [Potential Values: Live, Interval_5M, Interval_15M, Daily]

SELECT event_name FROM _TableName WHERE $__timeFilter(time_column)

Regards
Deepak

Sure. Just put $TableName in your query and it’ll be replaced with whatever value has been selected for the TableName template variable from the corresponding drop-down. http://docs.grafana.org/reference/templating/

Btw not sure why you prepend your variable name with an underscore. I don’t think there’s a rule against it, but underscore prefixes are generally used by Grafana’s internally defined variables.

Cool - Let me give this a shot. Point taken for variable name, will takecare.

Cheers!
Deepak