Does Grafana support chained variables with timescaledb?

Hello Everyone,

I have been trying to automatically get the columns from a table to be shown as variables in grafana.

This worked pretty good to me:

SELECT column_name
FROM information_schema.columns
WHERE table_name: 'mytable'

But I have been trying to have the possibility to “navigate” between different tables.

So I think a possible solution would be to set a Custom variable called “var” that would say mytable,mytable2,mytable3 and so on but Grafana doesn’t seem to recognize it correctly.

SELECT column_name
FROM information_schema.columns
WHERE table_name: $var

It just returns nothing. I wonder if this is the correct way to do it…

I also took a look into chained variables as explained here:

This could possibly be a solution,but the examples & the documentation just menctions the use cases with Graphite and influxdb using the expresion as apps.$app.* and /^$var$/ for them respectively.
Do you know if there is another way to get the desired result?
I mean implement either my current approach or the chained variable but with Timescaledb? Since I don’t know if is supported or not.

Thanks a lot.

What exact datasource plugin are you using? The built-in, core Postgres plugin? If so, that should support template variables

Yeah, It worked, it just needed an extra templating as string.

SELECT column_name
FROM information_schema.columns
WHERE table_name= ‘$var’

1 Like