pilosa的python客户端库
pilosa的Python项目详细描述
pilosa的python客户端
pilosa高性能分布式行索引的python客户端。
有什么新消息?
要求
- 与pilosa 1.2和pilosa 1.3兼容
- 需要Python2.7及更高版本或Python3.4及更高版本。
安装
pilosa客户端位于PyPI。可以使用pip
:
pip install pilosa
用法
快速概述
假设Pilosa服务器在localhost:10101
运行(默认值):
importpilosa# Create the default clientclient=pilosa.Client()# Retrieve the schemaschema=client.schema()# Create an Index objectmyindex=schema.index("myindex")# Create a Field objectmyfield=myindex.field("myfield")# make sure the index and field exists on the serverclient.sync_schema(schema)# Send a Set query. PilosaError is thrown if execution of the query fails.client.query(myfield.set(5,42))# Send a Row query. PilosaError is thrown if execution of the query fails.response=client.query(myfield.row(5))# Get the resultresult=response.result# Act on the resultifresult:columns=result.row.columnsprint("Got columns: ",columns)# You can batch queries to improve throughputresponse=client.query(myindex.batch_query(myfield.row(5),myfield.row(10),))forresultinresponse.results:# Act on the resultprint(result.row.columns)
文档
数据模型和查询
执行查询
导入和导出数据
见:Importing and Exporting Data
其他文件
贡献
许可证
见:LICENSE