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.0.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for clickhouse_pool-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e68316a9be477a6759dea5673da3acf3508535303e6621b1d87f4c654efbce1 |
|
MD5 | ec4b8b848ddb02f49a8443a1cc340d1c |
|
BLAKE2b-256 | 44f0e185c1106ef90794bdc33b08f33102ef9f795479094fcea46f34210b1a44 |