API¶
Module contents¶
-
class
clickhouse_pool.
ChPool
(**kwargs)[source]¶ Bases:
object
A ChPool is a pool of connections (Clients) to a ClickhouseServer.
-
connections_min
¶ minimum number of connections to keep open
- Type
int
-
connections_max
¶ maximum number of connections allowed open
- Type
int
-
closed
¶ if closed the pool has no connections and cannot be used
- Type
bool
-
cleanup
()[source]¶ Close all open connections in the pool.
This method loops through eveery client and calls disconnect.
-
get_client
(key: str = None) → Generator[clickhouse_driver.client.Client, None, None][source]¶ A clean way to grab a client via a contextmanager.
- Parameters
key – If known, the key of the client to grab.
- Yields
Client – a clickhouse-driver client
-