I want to provide a template list for tables in a mysql db. So I can do the query like so for the template
show tables in Archives like ‘table_%’
And it will build the list of table_2017_11, table_2017_10 and so on. That part is fine.
When I use the $Table now in my data source query I do something like this:
SELECT
DISTINCT Count(Event),
UNIX_TIMESTAMP(DATE_FORMAT(TimeStamp, ‘%Y-%m-%d %H:%i:%s’)) as time_sec,
Source as metric
FROM Archive.[[Table]]
and the generated sql looks like this:
SELECT
DISTINCT Count(Event),
UNIX_TIMESTAMP(DATE_FORMAT(TimeStamp, ‘%Y-%m-%d %H:%i:%s’)) as time_sec,
Source as metric
FROM Archive.‘table_2017_11’
I have tried using both $Table and [[Table]] and both are wrapped with the single ’ is there a different way to pass these template variables to the query without wrapping them in a single ’ ?
Thanks