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.pool import ChPool
# create a pool
pool = ChPool()
# get a clickhouse-driver client
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.close_all_connections()
Connection Pool Size
To change the connection pool size,
# create a pool with minimum 20 connections and a max of 40
pool = ChPool(connections_min=20, connections_max=40)
# get a clickhouse-driver client
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.close_all_connections()
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.2.0.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clickhouse-pool-0.2.0.tar.gz.
File metadata
- Download URL: clickhouse-pool-0.2.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9aa9ea811e26047e9806de80299676d6f38f018a92c8c3320a5291cc7dcc5fd5
|
|
| MD5 |
894deaf1242529c11d8859d832d9fa11
|
|
| BLAKE2b-256 |
e668c7d2f57c62a7dc1001ac3709564db4a7d84536785cf98df5f9b239a26dd1
|
File details
Details for the file clickhouse_pool-0.2.0-py3-none-any.whl.
File metadata
- Download URL: clickhouse_pool-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
186721078bd3a7b8a6793385a25d823234de043935ad08a647966f6c81660947
|
|
| MD5 |
cc2556c3d1f32b2ce90850e8cc6cfdd7
|
|
| BLAKE2b-256 |
2abf1b84bfbbbd7ecf76002507ce0e9dce2302834b7da70b202aec8803db71ea
|