A thread-safe connection pool for ClickHouse.
Project description
ClickHouse Pool for Python
A thread-safe connection pool for ClickHouse. Inspired by psycopg2
and using
clickhouse-driver
for
connections.
Installation
pip install clickhouse-pool
Quick Start
from clickhouse_pool import ChPool
pool = ChPool()
with pool.get_client() as client:
# execute sql and print the result
result = client.execute("SELECT * FROM system.numbers LIMIT 5")
print(result)
# always close all connections in the pool once you're done with it
pool.cleanup()
Connection Pool Size
To change the connection pool size,
pool = ChPool(connections_min=20, connections_max=40)
with pool.get_client() as client:
result = client.execute("SELECT * FROM system.numbers LIMIT 5")
print(result)
# always close all connections in the pool once you're done with it
pool.cleanup()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
clickhouse-pool-0.3.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for clickhouse_pool-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd706613f43ce59528a905206de9ed7b477f154546ddc5318dc48df3c05e97af |
|
MD5 | 058485bb558364255ea3b5ba494d18d7 |
|
BLAKE2b-256 | d3fe73d387316e7ad6f091d642f7dfd95e2b7a5eef106cc8aad61a809bca6c83 |