aioch
aioch is a library for accessing a ClickHouse database over native interface from the asyncio. It wraps features of clickhouse-driver for asynchronous usage.
Installation
The package can be installed using pip:
pip install aioch
To install from source:
git clone https://github.com/mymarilyn/aioch
cd aioch
python setup.py install
Usage
from datetime import datetime
import asyncio
from aioch import Client
async def exec_progress():
client = Client('localhost')
progress = await client.execute_with_progress('LONG AND COMPLICATED QUERY')
timeout = 20
started_at = datetime.now()
async for num_rows, total_rows in progress:
done = num_rows / total_rows if total_rows else total_rows
now = datetime.now()
# Cancel query if it takes more than 20 seconds to process 50% of rows.
if (now - started_at).total_seconds() > timeout and done < 0.5:
await client.cancel()
break
else:
rv = await progress.get_result()
print(rv)
async def exec_no_progress():
client = Client('localhost')
rv = await client.execute('LONG AND COMPLICATED QUERY')
print(rv)
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait([exec_progress(), exec_no_progress()]))
For more information see clickhouse-driver usage examples.
Parameters
executor- instance of custom Executor, if not supplied default executor will be usedloop- asyncio compatible event loop
Other parameters are passing to wrapped clickhouse-driver's Client.
License
aioch is distributed under the MIT license.
Metadata
Release files for aioch 0.0.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 |
|---|---|---|---|---|
| aioch-0.0.2.tar.gz | 4.8 kB | Without provenance | Details for aioch-0.0.2.tar.gz |
Release files / aioch-0.0.2.tar.gz
| Download URL | aioch-0.0.2.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e36c042d54c2386b5a36bf9a0c8a8e68da10ce51209a3c0854eb79fd36e0c03
|
|
BLAKE2b-256 checksum How to use checksums |
3c1b65c9e14966a940bcf5afa72a16f9e3924c815ba8fca8c0e133b20c73f697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.2
|
Security for aioch 0.0.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.