我想将超过 100 万条记录的 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")
给出一个奇怪的错误:
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'
有谁知道那是什么或我该如何解决?我真的应该改用 TinkerPop 吗?如果是这样,我将发布一个关于我与之斗争的单独问题。