用于通过本机接口从asyncio访问clickhouse数据库的库

aioch的Python项目详细描述


#aioch
**aioch**是一个通过本机接口从异步访问clickhouse数据库的库。
它包装了异步使用的[clickhouse驱动程序](https://github.com/mymarilyn/clickhouse-driver)的功能。

[![覆盖状态](https://coveralls.io/repos/github/mymarilyn/aioch/badge.svg?branch=master)(https://coveralls.io/github/mymarilyn/aioch?分支=主)
[![构建状态](https://travis-ci.org/mymarilyn/aioch.svg?(https://travis ci.org/mymarillyn/aioch/mymarillyn/aioch)








可以使用‘pip `:

` `` bash
pip install aioch
` ` ` ` ` ` `

` ` ` ` ` ` ` `
` ` ` ` ` `

` ` ` ` ` ` ` ` ` ` ` ` `


python setup.py安装##用法
``python
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 complex query')
timeout=20对于num_rows,正在进行的total_rows:
done=num_rows/total_rows if total_rows else total_rows
now=datetime.now()
如果处理50%的行需要20秒以上,则取消查询。
if(now-started_at).total_seconds()>;timeout and done<;0.5:
等待客户端。cancel()
break
否则:
rv=await progress.get_result()
打印(rv)




async def exec_no_progress():
client=client('localhost')
rv=await client.execute('long and complex query')
打印(rv


=asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait([exec_progress(),exec_no_progress()])
````


>有关详细信息,请参阅**clickhouse driver**用法示例。

如果未提供默认执行器,则将使用
*`loop`-与异步兼容的事件循环


其他参数将传递给包装好的clickhouse驱动程序客户端。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JAXB封送字符串,具有xml值,且不转义该值   java ModelMapper转换器不工作   java像HH000412或HCANN000001这样的前缀是什么意思?   验证日期输入修复java。lang.numberformatexception错误   当表具有外键时,java Telosys代码生成失败   如何使所有派生类一起只能实例化一个实例的单例抽象基类?(爪哇)   java如何在非静态服务类中使用广播接收器   java nutch爬虫相对URL问题   使用Jboss DMR下载/保存java附件   Rest模板:无法提取响应:当我们得到xml响应时,没有找到适合响应类型的HttpMessageConverter,没有绑定到JAVA对象   java如何编写可扩展窗格/面板/卡的代码   java是在ITreeViewerListener的treeExpanded()之前调用ContentProvider的getChildren()吗?   java将JComponent添加到小程序窗格   java混淆:使用简单逻辑的Flames程序