Search code examples
py2neo

How to batch queries and perform them later in pyneo2 v3?


In py2neo V2, it was possible to do this by using query.append() which add the query to a queue and all the queries can be executed later.

How can I do the same thing in v3? I cannot find an equivalent function in the documentation for this.


Solution

  • The following is in Python 3.6.3 using py2neo version 3.1.2:

    from py2neo import Graph g = Graph(host="localhost", user="neo4j", bolt=True) # Modify for your situation transaction = g.begin(autocommit=False) transaction.append("match(n) return count(n);")

    This fails and returns the following warning:

    /usr/local/bin/ipython3:1: DeprecationWarning: Transaction.append(...) is deprecated, use Transaction.run(...) instead

    Hope this helps.