ClickHouse / clickhouse-connect

Python driver/sqlalchemy/superset connectors
Apache License 2.0
329 stars 64 forks source link

How to intercept all sql queries? #419

Open gonemooncool opened 1 week ago

gonemooncool commented 1 week ago

I want to track all queries that go through clickhouse_connect, including “service” requests.

In driver.client.Client._init_common_settings there are some “service” queries that I cannot intercept. Is there any way to intercept any queries that go through clickhouse_connect without rewriting driver.client.Client?

genzgd commented 1 week ago

There is not currently a way to do that. It might make sense to add a "hook" within the query* or _raw_query Client methods to allow this sort of functionality.