-
Notifications
You must be signed in to change notification settings - Fork 328
Open
Labels
Description
There are use cases where we need to dynamically configure the FROM statement in a given query via a SQL expression and tokens from the query itself.
Internally, there's a use case that roughly translates to:
SELECT ...
FROM ${
SELECT if($variable, 'table1', 'table2')
} -- string interpolation with the results of another SQL query
We should figure out a way to support this. A simple way would be to support handlebars templating and allow users to express logic in JS. However, being able to run a custom query for the FROM statement would allow for even more flexible templating (as it can query data from ClickHouse before returning a calculated value).