Variable select column


#1

Is it possible to variably select column names? For example, product.{{type}} where type is a variable?


#2

Hi @roaringpat
That is not possible. This is to prevent SQL injection, which is a huge security risk.
There’s an old issue discussing this - https://github.com/metabase/metabase/issues/4610


#3

Way to do that would be to use a stored procedure or similar. Depends upon your source data.
Big pain is that the query optimiser will have to work out a new plan every time, so not efficient.