aiochsa
Clickhouse Python/asyncio library for use with SQLAlchemy core
Example
import aiochsa
import sqlalchemy as sa
table = sa.Table(
'test', sa.MetaData(),
sa.Column('id', sa.Integer),
sa.Column('name', sa.String),
)
async with aiochsa.connect('clickhouse://127.0.0.1:8123') as conn:
await conn.execute(
table.insert(),
[
{'id': 1, 'name': 'Alice'},
{'id': 2, 'name': 'Bob'},
],
)
rows = await conn.fetch(
table.select()
)
To add FINAL modifier use with_hint(table, 'FINAL') (see SQLAlchemy docs for details).
Configure logging to show SQL:
logging.getLogger('aiochsa.client.SQL').setLevel(logging.DEBUG)
Custom type converters
Here is an example of installing converter for ClickHouse’s DateTime type that requires and returns timezone-aware Python’s datetime object and stores it as UTC:
from datetime import datetime
import aiochsa
from aiochsa.types import DateTimeUTCType, TypeRegistry
types = TypeRegistry()
types.register(DateTimeUTCType, ['DateTime'], datetime)
conn = aiochsa.connect(dsn, types=types)
Change log
See CHANGELOG.
Development
Prerequizites: Python (use pyenv to manage multiple versions), pip, tox, coverage, docker, docker-compose.
Running tests:
# Run whole tests matrix:
tox
# Run test with specific Python version only:
tox -e py38
# Test with specific Clickhouse version:
tox -e py38 -- --clickhouse-version=21.2.2.8
# Run specified test(s):
tox -e py38 -- tests/test_execute.py::test_aggregate_function
Metadata
Release files for aiochsa 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiochsa-1.2.2.tar.gz | 30.6 kB | Without provenance | Details for aiochsa-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiochsa-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for aiochsa-1.2.2-py3-none-any.whl |
Total release size: 52.1 kB
Release files / aiochsa-1.2.2.tar.gz
| Download URL | aiochsa-1.2.2.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eecb3cfb354cd25cca50a15a96ecc29dee873c8f4986dd1553a72e1b823b6e1f
|
|
BLAKE2b-256 checksum How to use checksums |
df9c20f8af7b202f408720aebd75233d9ad92928e7b772cfd4419a32e2723a70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / aiochsa-1.2.2-py3-none-any.whl
| Download URL | aiochsa-1.2.2-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8820dab192e23760f21442950f9a0a40283c8d6ec9cd0c06a73b28273cc31075
|
|
BLAKE2b-256 checksum How to use checksums |
c65fe7d60ee0ec3caf99c7f490bc300059050faf0dba18d569ff25af1517482c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for aiochsa 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.