sonic数据库的异步python客户端
asonic的Python项目详细描述
asonic实现所有
Sonicapi
欢迎进行错误修复和api更改
安装
pip install asonic
API文档
用法
搜索频道
importasynciofromasonicimportClientfromasonic.enumsimportChannelsasyncdefmain():c=Client(host='127.0.0.1',port=1491,password='SecretPassword',max_connections=100)awaitc.channel(Channels.SEARCH.value)# or simply searchawaitc.query('collection','bucket','quick')=='user_id'awaitc.suggest('collection','bucket','br',1)=='brown'if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(main())
摄取通道
importasynciofromasonicimportClientfromasonic.enumsimportChannelsasyncdefmain():c=Client(host='127.0.0.1',port=1491)awaitc.channel(Channels.INGEST.value)# or simply ingestawaitc.push('collection','bucket','user_id','The quick brown fox jumps over the lazy dog')# Return b'OK'awaitc.pop('collection','bucket','user_id','The')# Return 1if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(main())
控制通道
importasynciofromasonicimportClientfromasonic.enumsimportChannels,Actionsasyncdefmain():c=Client(host='127.0.0.1',port=1491)awaitc.channel(Channels.CONTROL.value)# or simply controlawaitc.trigger(Actions.CONSOLIDATE)# or simply consolidate# Return b'OK'awaitingest.pop('collection','bucket','user_id','The')# Return 1if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(main())
推荐PyPI第三方库
- 热门话题
- JavaSpring异步数据库交互 java中的正则表达式模式/数组问题 swing在Java中设置按钮的位置 java如何实现基于松散耦合的代码散播主方法 velocity模板渲染的java过滤器问题 java如何在liferay中使用EmailAddressLocalService 多线程如何确保长时间运行的Java线程永不消亡 java如何以编程方式在Android启动器之间切换 安卓中的java解析查询问题 Java中的变量浅拷贝整数 SimpleDataFormat中月份的java奇怪问题 java如何在输入流中间读取偏移量? 使用MyComparator类的java排序ArrayList java HeapDumpOnOutOfMemoryError创建空的hprof文件 java“around”通知的内容可以从单独的函数执行吗? java将组件添加到我的GridBagLayout会将其他组件移到最右边 带有“WHERE”选择参数的java Android SQLite查询不起作用 安卓 Java NPE错误(尝试在空对象引用上调用虚拟方法) java Print 2并排排列的ArrayList