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()
Testing Locally
To run tests locally ensure you have an instance of clickhouse-server running on localhost. The easiest way is to use docker:
docker run -d -p 9000:9000 yandex/clickhouse-server
python tests.py
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.4.0.tar.gz
(3.9 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.4.0.tar.gz.
File metadata
- Download URL: clickhouse-pool-0.4.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28ae95ccca3714e0dba69f2127ceb049e88c7c208ef274dfe9ec0273f358c9c7
|
|
| MD5 |
557049986ba762371ff98223b1e7ff7e
|
|
| BLAKE2b-256 |
b8e08ba1b1b6c11e701b8b43a67e3181b0ca44e391ced123fc8f4b9792715a7c
|
File details
Details for the file clickhouse_pool-0.4.0-py3-none-any.whl.
File metadata
- Download URL: clickhouse_pool-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b524889b37fe588317c4bd106136ae3518f210c84bebb6371c276749dd012cc
|
|
| MD5 |
651ae17dc3126d1384ac389c920aca40
|
|
| BLAKE2b-256 |
b866be4c4d4c0eaa980efcb991db94f3eeb9b33b3a4b00cd5754b22e5d465214
|