I'm trying to update a node using py2neo as part of a transaction.
The problem is I can't seem to find an equivalent of Graph.push()
such as Transaction.Push()
. Am I missing something obvious?
My code at the moment looks like this, I'd like to resolve the obvious ????
bit.
def write_to_database( self, t: Transaction ) -> None:
n = None
use_existing = False
# Not part of the transaction:
n = t.graph.find_one( "Node", "name", self.name( ) )
if n:
use_existing = True
else:
n = Node(label)
n[ "name" ] = self.name( )
n["size"] = self.get_size()
if use_existing:
t.??????????????? # Put this in the transaction!
else:
t.create( n )
As a use-case point, I'm using the transaction because it appears to run faster for 1000s of operations, not because I require roll-back functionality.