从Python访问OrientDB

Tom*_*omG 5 python orientdb pyorient

我想将> 1mn记录的MySQL数据库转换为图形数据库,因为它是重度链接的网络类型数据.Neo4J的免费版本有一些我认为可能会遇到的限制,因此我安装了OrientDB(Community 2.2.0)(在Ubuntu Server 16.04上)并使其正常运行.现在我需要从Python(3.5.1+)访问它,所以我正在尝试pyorient(1.5.2).(我尝试使用TinkerPop,因为我最终想要使用Gremlin,并且无法让gremlin控制台与OrientDB交谈.)

以下简单的Python代码,用于连接到OrientDB中的一个测试图:

import pyorient

username="user"
password="password"

client = pyorient.OrientDB("localhost", 2424)
session_id = client.connect( username, password )

print("SessionID=",session_id)

db_name="GratefulDeadConcerts"

if client.db_exists( db_name, pyorient.STORAGE_TYPE_MEMORY ):
    print("Database",db_name,"exists")
    client.db_open( db_name, username, password )
else:
    print("Database",db_name,"doesn't exist")
Run Code Online (Sandbox Code Playgroud)

给出了一个奇怪的错误:

SessionID= 27
Database GratefulDeadConcerts exists
Traceback (most recent call last):
  File "FirstTest.py", line 18, in <module>
    client.db_open( db_name, username, password )
  File "/home/tom/MyProgs/TestingPyOrient/env/lib/python3.5/site-packages/pyorient/orient.py", line 379, in db_open
    .prepare((db_name, user, password, db_type, client_id)).send().fetch_response()
  File "/home/tom/MyProgs/TestingPyOrient/env/lib/python3.5/site-packages/pyorient/messages/database.py", line 141, in fetch_response
    info = OrientVersion(release)
  File "/home/tom/MyProgs/TestingPyOrient/env/lib/python3.5/site-packages/pyorient/otypes.py", line 202, in __init__
    self._parse_version(release)
  File "/home/tom/MyProgs/TestingPyOrient/env/lib/python3.5/site-packages/pyorient/otypes.py", line 235, in _parse_version
    self.build = int( self.build )
ValueError: invalid literal for int() with base 10: '0 (build develop@r79d281140b01c0bc3b566a46a64f1573cb359783; 2016'
Run Code Online (Sandbox Code Playgroud)

有谁知道这是什么或如何解决它?我应该真的使用TinkerPop吗?如果是这样的话,我会发布一个关于我与之斗争的单独问题.

Iva*_*tti 2

我首先收到错误,但将 Pyorient 升级到最新版本 1.5.4 后,我没有收到任何错误。

$ python test.py 
('SessionID=', 6)
('Database', 'GratefulDeadConcerts', 'exists')
Run Code Online (Sandbox Code Playgroud)
$ python --version
Python 2.7.11
Run Code Online (Sandbox Code Playgroud)