How to combine cypher queries into a transaction in Py2neo v3

Viewed 2120

In py2neo v2.0, it was possible to use a transaction to execute Cypher statements:

tx=graph.cypher.begin()
tx.append("MERGE (n:Process {proc_nm : {proc_nm}}) ON CREATE SET n.count = 1 ON MATCH SET n.count = n.count +1", {proc_nm : 'wibble'})
tx.commit

When processing complex files this allows very fast updates to be made to the Neo4J database.

In py2neo v3.0 the syntax has changed to:

graph.run(("MERGE (n:Process {proc_nm : {proc_nm}}) ON CREATE SET n.count = 1 ON MATCH SET n.count = n.count +1", {proc_nm : 'wibble'}))

This means that I can run the cypher statements singly but the performance takes a massive hit. I can write CREATE/MERGE for the Nodes and Relationships however I was hoping to not have to re-write a bunch of routines that I'm already using. What am I missing?

1 Answers
Related