Current collected state Current
Observed since 21 Oct, 11:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Library for accessing a ClickHouse database over native interface from the asyncio
aioch2 is a library for accessing a ClickHouse database over native interface from the asyncio. It wraps features of clickhouse-driver for asynchronous usage.
The package can be installed using pip:
pip install aioch2
from datetime import datetime
import asyncio
from aioch2 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.
executor - instance of custom Executor, if not supplied default executor will be usedloop - asyncio compatible event loopOther parameters are passing to wrapped clickhouse-driver's Client.
aioch2 is distributed under the MIT license.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.0.4 | 19 Nov 2021 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 11:43 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:ed895e2f4933d27c865d9d71bb78e58b50c54e3ee74f52f80cc65c79fe0f6c06