pyorient icon indicating copy to clipboard operation
pyorient copied to clipboard

Not working with orientdb 3.0

Open tjtimer opened this issue 7 years ago • 16 comments

I can't connect to my orientdb (version 3.0) database. Traceback: Traceback (most recent call last): File "", line 1, in File "/var/www/projects/pydev/bonham/venv/lib/python3.6/site-packages/pyorient/orient.py", line 411, in db_open info, clusters, nodes = self.get_message("DbOpenMessage")
File "/var/www/projects/pydev/bonham/venv/lib/python3.6/site-packages/pyorient/orient.py", line 540, in get_message message_instance = _Message(self._connection)
File "/var/www/projects/pydev/bonham/venv/lib/python3.6/site-packages/pyorient/messages/database.py", line 47, in init super(DbOpenMessage, self).init(_orient_socket) File "/var/www/projects/pydev/bonham/venv/lib/python3.6/site-packages/pyorient/messages/base.py", line 24, in init sock.get_connection() File "/var/www/projects/pydev/bonham/venv/lib/python3.6/site-packages/pyorient/orient.py", line 78, in get_connection self.connect() File "/var/www/projects/pydev/bonham/venv/lib/python3.6/site-packages/pyorient/orient.py", line 103, in connect " is not supported yet by this client.", []) pyorient.exceptions.PyOrientWrongProtocolVersionException: Protocol version 37 is not supported yet by this client.

tjtimer avatar Jan 29 '18 19:01 tjtimer

Same here. Not sure if this project is still active? It seems to have been a while since last commit.

linmao-song avatar Feb 08 '18 16:02 linmao-song

i just updated the constants.py to support the lastest protocol 37 and its working, but not sure if it has any implications. Here is the working pyorient module for orientdb3.0.0 https://github.com/rrmerugu/pyorient/ you can install with pip install git+https://github.com/rrmerugu/pyorient/

rrmerugu avatar May 13 '18 20:05 rrmerugu

Should be tested, some internal changes could be happened. This requires manual test and debug.

Ostico avatar May 17 '18 19:05 Ostico

You can try, but keep in mind that this is not production ready.

Ostico avatar May 17 '18 19:05 Ostico

@Ostico is there any roadmap to support 3.0.0 soon ?

rrmerugu avatar May 19 '18 07:05 rrmerugu

Same problem here. pyorient 1.5.5 orientdb 3.0.2

ghost avatar Jun 07 '18 11:06 ghost

Starting with OrientDB 3.0.3, it adds a check to protocol 37 during the connect phase to see if a handshake is used. If a client specifies it supports protocol 37 but does not perform an initial handshake, it will fail.

The simplest solution is to still use protocol 36 (OrientDB will adjust accordingly) until the handshake, etc. can be implemented and to comment out this in orient.py:

        if self.protocol > SUPPORTED_PROTOCOL:
            raise PyOrientWrongProtocolVersionException(
                "Protocol version " + str(self.protocol) +
                " is not supported yet by this client.", [])

@Ostico could we comment that out, test it, and publish it to pip?

OrientDBColin avatar Aug 06 '18 19:08 OrientDBColin

I went ahead and commented the protocol check out so that, at least, it will communicate with OrientDB 3.0.x now.

Your mileage may vary...

OrientDBColin avatar Oct 18 '18 19:10 OrientDBColin

Tested and checked with PHPOrient, this solution works, i will update pyOrient also as soon as possible

Ostico avatar Dec 10 '18 14:12 Ostico

@Ostico when can you updata it? I have the same problem.

lalala0731 avatar Jan 22 '19 06:01 lalala0731

@Ostico, @mogui, any chance we could get this patch pushed to pypi?

thenesk avatar Apr 26 '19 09:04 thenesk

Until it's pushed to pypi, you can install the module via: pip install git+https://github.com/orientechnologies/pyorient

Cornoualis avatar Dec 17 '19 17:12 Cornoualis

I forked a version and patched: https://github.com/OpenConjecture/pyorient

Install (be sure to use --upgrade flag to override local cache):

pip install --upgrade git+https://github.com/OpenConjecture/pyorient.git

Connect and test.

python
>> client = pyorient.OrientDB("localhost", 2424)
>> client.set_session_token(True)
>> session_id = client.connect( "admin", "admin" )

geastham avatar Jun 20 '20 18:06 geastham

I am new to orientdb and I have been a little puzzled by all the forks and the lack of activity in pyorient, so maybe my comment will sound a little bit naive. Sorry.

I can tell that the fork https://github.com/OpenConjecture/pyorient appear to work so far.

It appears that, at least in 3.1.0, the binary protocol for error messages changed, causing pyorient to fail interpreting the binary output.

I generally get an output of the form

PyOrientCommandException                  Traceback (most recent call last)
~/perso/perso/python/clk_commands_perso/orientdb.py in <module>
----> 1 o.client.db_drop("docs")

~/.local/lib/python3.8/site-packages/pyorient/orient.py in db_drop(self, name, type)
    375         :return: None
    376         '''
--> 377         self.get_message("DbDropMessage") \
    378             .prepare((name, type)).send().fetch_response()
    379         return None

~/.local/lib/python3.8/site-packages/pyorient/messages/database.py in fetch_response(self)
    419 
    420     def fetch_response(self):
--> 421         return super(DbDropMessage, self).fetch_response()
    422 
    423     def set_db_name(self, db_name):

~/.local/lib/python3.8/site-packages/pyorient/messages/base.py in fetch_response(self, *_continue)
    263         # already fetched, get last results as cache info
    264         elif len(self._body) is 0:
--> 265             self._decode_all()
    266             self.dump_streams()
    267         return self._body

~/.local/lib/python3.8/site-packages/pyorient/messages/base.py in _decode_all(self)
    247 
    248     def _decode_all(self):
--> 249         self._decode_header()
    250         self._decode_body()
    251 

~/.local/lib/python3.8/site-packages/pyorient/messages/base.py in _decode_header(self)
    178                     del serialized_exception
    179 
--> 180             raise PyOrientCommandException(
    181                 exception_class.decode( 'utf8' ),
    182                 [ exception_message.decode( 'utf8' ) ]

PyOrientCommandException:  - 

Do you have a similar experience sometimes ?

Konubinix avatar Jun 27 '20 20:06 Konubinix

Hello @Konubinix ! I have the same experience. Do you think it has anything to do with OrientDB 3.1+ version ? (I am currently using 3.1.6 version)

Amioplk avatar Jan 14 '21 22:01 Amioplk

Sorry, I have given up using orientdb, as it is way to resource greedy to run on my Raspberry Pi 3B+. So I won't be able to answer you.

Konubinix avatar Jan 15 '21 08:01 Konubinix