Search code examples
clickhouse

Is it possible to pass LIVE VIEW name as a parameter in Clickhouse query?


For example, like

CREATE LIVE VIEW %(live_view_name)s WITH REFRESH

It works only with other parameters (WHERE condition) but not with view name.


Solution

  • Look like you use python for make HTTP query?

    I think it's not possible because parameter value will escape as string literal, not as field name

    Look to https://clickhouse.com/docs/en/interfaces/http#cli-queries-with-parameters and

    https://clickhouse.com/docs/en/interfaces/cli#cli-queries-with-parameters

    and try to use CREATE LIVE VIEW {live_view_name:Identifier} WITH REFRESH