transaction function
A function the driver runs inside a transaction it manages, retrying it when a failure was transient.
Example
A function handed to the driver rather than a transaction opened by hand.
python
def create_person(tx, name, age):
result = tx.run("""
CREATE (p:Person {name: $name, age: $age})
RETURN p
""", name=name, age=age)The first argument is always a ManagedTransaction. Any further arguments come from the call to execute_read or execute_write. The driver opens the transaction, runs the function inside it, and commits when the function returns. If the write fails for a transient reason, such as a leader election in a cluster, the driver runs the function again.
Lessons that use this term
The lesson and course links below open in a new tab.
7 lessons use this term. Results are ordered by term density.
Using Neo4j with Java4 mentions
- Transaction functionsBest practiceshave written a transaction function called getCheapestFlights to execute a read query within a1 mention
- Transaction managementBest practicescan execute multiple queries within the same transaction function to ensure that all operations are completed or fail as a single3 mentions
Using Neo4j with Go6 mentions
- Transaction functionsBest practiceshave written a transaction function called getCheapestFlights to execute a read query within a1 mention
- Transaction managementBest practicescan execute multiple queries within the same transaction function to ensure that all operations are completed or fail as a single5 mentions
Using Neo4j with Python5 mentions
- Transaction functionsBest practiceshave written a transaction function called get_cheapest_flights to execute a read query within a1 mention
- Transaction managementBest practicesfirst argument to the transaction function is always a4 mentions
Using Neo4j with .NET2 mentions
- Transaction managementBest practicescan execute multiple queries within the same transaction function to ensure that all operations complete or fail as a single2 mentions