Making sure table/materialized view created before continuing next command on Clickhouse

136 Views Asked by At

I'm using clickhouse-go, sometimes when I run create multiple materialized view, then query from those materialized view it shows success, but sometimes failed because the materialized view not yet created (table default.the_mv_name doesn't exists)

Is there any workaround so the db.Exec("CREATE MATERIALIZED VIEW .... POPULATE AS SELECT ...") only return when it's successfully created. Something like SELECT ... FROM bla FINAL when querying.

Or there's no workaround, so I have to loop and check system.columns table until it's ready?

for non-replicated engine - there's around 50% chance it's happened, for replicated engine - almost always happened

0

There are 0 best solutions below