aiochclient icon indicating copy to clipboard operation
aiochclient copied to clipboard

CREATE LIVE VIEW and WATCH support

Open knoguchi opened this issue 4 years ago • 1 comments

I wonder if the LIVE VIEW and WATCH statements support is in plan. ClickHouse 19.16.3.6 introduced this feature. The client can get notified when a new data is inserted. It eliminates polling using SELECT.

Some of the things that I thought about.

  • A cursor should be able to watch existing LIVE VIEW
  • A cursor should be able to create a TEMPORARY LIVE VIEW with hash ID (maybe application should handle this. Each app has a different security requirement)
  • handle response in event driven manner
  • handle heart beat for the long-lived connection

Should it be implemented in a different package? Any thoughts?

Relevant articles https://www.altinity.com/blog/2019/11/13/making-data-come-to-life-with-clickhouse-live-view-tables https://www.altinity.com/blog/2019/12/05/taking-a-closer-look-at-clickhouse-live-view-tables

knoguchi avatar Jun 08 '20 17:06 knoguchi

@knoguchi thank you for update! I will think about it. We can implement its interface as async event generator. I will check Clickhouse http API. By the way, if you have any ideas how to implement it or want to make PR you are welcome!

maximdanilchenko avatar Jun 10 '20 11:06 maximdanilchenko