arangodb的python驱动程序

python-arango的Python项目详细描述


https://cloud.githubusercontent.com/assets/2701938/18018900/668e15d2-6ba7-11e6-85a9-7997b3c6218a.png

Travis Build StatusDocumentation StatusPackage VersionPython VersionsTest CoverageIssues OpenMIT License

欢迎来到github页面,python arango,这是一个用于ArangoDB的python驱动程序。

公告

  • python arango版本5.0.0终于发布了!此版本支持ArangoDB 仅3.5+版。它还破坏了向后兼容性,您必须 更改应用程序代码。详情请参阅releases页。

功能

  • pythonic接口
  • 重量轻
  • 高API覆盖率

兼容性

  • 支持Python版本2.7、3.4、3.5、3.6和3.7
  • python arango 5.x支持arangodb 3.5+
  • python arango 4.x仅支持arangodb 3.3~3.4
  • python arango 3.x仅支持arangoDB 3.0~3.2
  • python arango 2.x仅支持arangodb 1.x~2.x

安装

PyPi安装稳定版本:

~$ pip install python-arango

直接从GitHub安装最新版本:

~$ pip install -e git+git@github.com:joowani/python-arango.git@master#egg=python-arango

根据环境的不同,您可能需要使用sudo

开始

下面是一个简单的用法示例:

fromarangoimportArangoClient# Initialize the client for ArangoDB.client=ArangoClient(hosts='http://localhost:8529')# Connect to "_system" database as root user.sys_db=client.db('_system',username='root',password='passwd')# Create a new database named "test".sys_db.create_database('test')# Connect to "test" database as root user.db=client.db('test',username='root',password='passwd')# Create a new collection named "students".students=db.create_collection('students')# Add a hash index to the collection.students.add_hash_index(fields=['name'],unique=True)# Insert new documents into the collection.students.insert({'name':'jane','age':39})students.insert({'name':'josh','age':18})students.insert({'name':'judy','age':21})# Execute an AQL query and iterate through the result cursor.cursor=db.aql.execute('FOR doc IN students RETURN doc')student_names=[document['name']fordocumentincursor]

下面是另一个图形示例:

fromarangoimportArangoClient# Initialize the client for ArangoDB.client=ArangoClient(hosts='http://localhost:8529')# Connect to "test" database as root user.db=client.db('test',username='root',password='passwd')# Create a new graph named "school".graph=db.create_graph('school')# Create vertex collections for the graph.students=graph.create_vertex_collection('students')lectures=graph.create_vertex_collection('lectures')# Create an edge definition (relation) for the graph.register=graph.create_edge_definition(edge_collection='register',from_vertex_collections=['students'],to_vertex_collections=['lectures'])# Insert vertex documents into "students" (from) vertex collection.students.insert({'_key':'01','full_name':'Anna Smith'})students.insert({'_key':'02','full_name':'Jake Clark'})students.insert({'_key':'03','full_name':'Lisa Jones'})# Insert vertex documents into "lectures" (to) vertex collection.lectures.insert({'_key':'MAT101','title':'Calculus'})lectures.insert({'_key':'STA101','title':'Statistics'})lectures.insert({'_key':'CSC101','title':'Algorithms'})# Insert edge documents into "register" edge collection.register.insert({'_from':'students/01','_to':'lectures/MAT101'})register.insert({'_from':'students/01','_to':'lectures/STA101'})register.insert({'_from':'students/01','_to':'lectures/CSC101'})register.insert({'_from':'students/02','_to':'lectures/MAT101'})register.insert({'_from':'students/02','_to':'lectures/STA101'})register.insert({'_from':'students/03','_to':'lectures/CSC101'})# Traverse the graph in outbound direction, breadth-first.result=graph.traverse(start_vertex='students/01',direction='outbound',strategy='breadthfirst')

查看documentation了解更多信息。

贡献

请在提交拉取请求之前查看此page。谢谢!

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

推荐PyPI第三方库


热门话题
编译器构造为什么在Java中允许初始化对Null的引用?   java手动调用javax的actionPerformed。摆动计时器   使用git分支的java Maven版本控制   Java8句子流   java JPA OneToOne和OneToMany实体实例化/创建   java如何将值添加到列表<Map<String,Object>>?   java如何使用ComboBox在一个框架内更改JPanel。getSelectedIndex()   java在比较XML和xmlunit时忽略文本差异   java无法从其他pc连接到本地主机   Java中分配对象id的优雅方式   Java中静态变量的使用   java试图从Neteller获取OAuth访问令牌时产生错误:“服务器返回HTTP响应代码:401表示URL”   Java:基元类型是否会影响性能?   java可以让hasNext()不区分大小写吗?   基于AutoCompleteTextView建议属性或AutoCompleteTextView值的java Android搜索   java流文件到firefox浏览器有时无法打开应用程序对话框   在没有ArrayList的Java中返回数组中的搜索结果   复制java。木卫一。IOException:数据错误(CRC)   java为什么我在尝试删除Facebook测试用户时会出现“方法未实现”错误   java如何使用JNA调用SetProcessReliationPolicy