versae / neo4j-rest-client

Object-oriented Python library to interact with Neo4j standalone REST server
http://neo4j-rest-client.rtfd.org
GNU General Public License v3.0
264 stars 73 forks source link

Using global tx in query results in failure of following operation #103

Closed rudaoshi closed 10 years ago

rudaoshi commented 10 years ago

ex:

nodes = gb.query('...')

nodes[0].relationships.all() # returns None

versae commented 10 years ago

That happens because transactions for Cypher queries are handled differently that transactions for the rest of the API: for Cypher neo4jrestclient uses the Transactional REST endpoint; nodes[0].relationships.all() is using Batch endpoint. Mixing both in the same transaction block is not yet supported.

Drekin commented 10 years ago

There are other issues when gb.query saves transaction in global variable. Even if the transaction is finishead after query call, it prevents gb.node call to succeed. It tries to use the stored QueryTransaction and ends with non-informative exception when tx.append is called but has different signature. See http://stackoverflow.com/questions/24064307/typeerror-neo4jrestclient-append-got-an-unexpected-keyword-argument-data. At least a more informative exception should be raised.

Another thing is that after gb.query("") which raises syntax error, all the following query calls end with the same syntax error because of the stored transaction.

versae commented 10 years ago

I see. I will take a look to see how come up with a proper fix.