Skip to main content

ClickHouse Pool for Python

PyPI PyPI - License Read the Docs

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

# find available settings at https://clickhouse-driver.readthedocs.io/en/latest/api.html#clickhouse_driver.Client
pool = ChPool(host="localhost")

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
poetry run pytest

Building Docs

poetry run sphinx-build -M html docs/source docs/_build

Metadata

Release files for clickhouse-pool 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clickhouse-pool 0.6.1
File Size Uploaded
clickhouse_pool-0.6.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clickhouse-pool 0.6.1
File Interpreter ABI Platform
clickhouse_pool-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / clickhouse_pool-0.6.1.tar.gz

Download URL clickhouse_pool-0.6.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9a888d90c8661eb0cf3c459791d800a21a226c960a6872c95561ec5fab5a2ebf
BLAKE2b-256 checksum
How to use checksums
3357de9a73299f21cfa09a086a984147f52b7ede3efcd5e07968e84c4d098a9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.11 Linux/6.11.0-1018-azure

Release files / clickhouse_pool-0.6.1-py3-none-any.whl

Download URL clickhouse_pool-0.6.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bacf3fb138a45d29b4300e1646b425b4c5bd28ec953b24840ba5d64203eb6b2a
BLAKE2b-256 checksum
How to use checksums
c4873bfd9e3d775b7ac1e4792c3d2ffb4a17eda1665be1ff2a813a7e4b5ef56a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.11 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page