eve-arangodb数据层

eve-arango的Python项目详细描述


https://badge.fury.io/py/eve-arango.svghttps://travis-ci.org/tangram/eve-arango.svg?branch=master

为与eve rest api框架一起使用的arangodb提供一个数据层。

功能

  • 使用arangodb作为文档存储的crud操作
  • 支持对边缘文档执行相同的操作以管理关系
  • 基于AQL语法的筛选
  • 分页和排序

不支持(尚未):

  • 正确的图形查询
  • 版本控制
  • 投影
  • 聚合

安装

$ pip install eve-arango

用法

fromeveimportEvefromeve_arangoimportArangoDBapp=Eve(data=ArangoDB)app.run()

将处理以下设置:

# These are necessary for item lookups to work,# the regex is for the characters allowed in ArangoDB keys.ID_FIELD='_key'ITEM_LOOKUP_FIELD=ID_FIELDITEM_URL='regex("[\w\d\-:.@()+,=;$!*\'%]+")'# If a database named ARANGO_DB's value doesn't exist,# it will be created when the data layer is initialized.ARANGO_DB='database_name'ARANGO_HOST='localhost'ARANGO_PORT=8529# If the keys in DOMAIN do not exist as collection names,# they will be created when the data layer is initialized.# There's no need to add '_id', '_key' or '_rev' fields,# they are added to the schema automatically.# If you specifiy 'edge_collection': True as below,# an edge collection will be created if it does not exist.DOMAIN={'people':{'schema':{'name':{'type':'string'}}},'friends_with':{'edge_collection':True},# ...}

过滤和排序

eve arango使用aql语法通过evewhere参数进行过滤。Mongo样式查询无效。下面是一些有效(url解码)查询及其结果aql的示例:

?where=foo == "bar"
# Spaces are optional.
# FILTER doc.foo == "bar"

?where=numIN[1,2,3],present!=null
# Use , as simple separator between FILTER expressions.
# FILTER doc.num IN [1,2,3]
# FILTER doc.present != null

?where=a=="a"ANDb=="b"ORc=="c"
# AND, OR, NOT can be used to combine expressions.
# FILTER doc.a == "a" AND doc.b == "b" OR doc.c == "c"

排序使用常规的eve语法。示例如下:

?sort=name,-age
# SORT doc.name, doc.age DESC

贡献

欢迎捐款。打开问题并发送请求。

许可证

MIT License

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

推荐PyPI第三方库


热门话题
java JNLP无法在浏览器中正确启动(与dtjava.js一起部署)   在执行下一个方法之前,java将等待线程执行结束   java如何将另一个LayoutManager应用于JComboBox?(多栏JComboBox尝试)   使用jPBC在java中实现双线性配对   java在使用@RequestMapping注释时获取请求的值(URL)   java如何控制流量   java如何获取IFC对象的绝对坐标?   java目标服务器无法使用htmlunit和tor响应异常   java需要帮助创建一个循环结构来运行我的程序   java有可能拥有一个Android APK并在应用程序中更改构建变体吗?   在Sphinx4中运行Ant的java   Java:从ArrayList获取子列表的有效方法   java如何使在循环内部创建的数组在循环外部工作?   apache poi通过java中的XSSF表从单元格读取日期值   安卓 java自己的SeqLock实现,避免spinlock会更好吗?   java的并发底层方法。util。同时发生的预定未来   java比较方法违反了它的一般约定,如何使它具有可传递性?   使用JAVA定向指定类的DB导出子类   一个方法中的java更改特定imageView