vendredi 24 juin 2016

Accessing OrientDB from Python


I want to convert a >1mn record MySQL database into a graph database, because it is heavily linked network-type data. The free version of Neo4J had some restrictions I thought I might bump up against, so I've installed OrientDB (Community 2.2.0) (on Ubuntu Server 16.04) and got it working. Now I need to access it from Python (3.5.1+), so I'm trying pyorient (1.5.2). (I tried TinkerPop since I eventually want to use Gremlin, and couldn't get the gremlin console to talk to the OrientDB.) The following simple Python code, to connect to one of the test graphs in 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") gives a weird error: 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' Does anyone know what that is or how I can fix it? Should I really be using TinkerPop instead? If so I'll post a seperate question about my struggles with that.

Aucun commentaire:

Enregistrer un commentaire