Hi,
I am trying to get a transaction summary after a read or write transaction using neo4j python-driver
. I have written some code to get this but these aren't working.
Code
def write_data(tx, query):
result = tx.run(query)
record = result.single()
value = record.value()
info = result.consume()
return value, info
def commit_data(query):
with driver.session(database="neo4j") as session:
node_id, info = session.write_transaction(write_data,query)
print(node_id, info, type(node_id), info.database, info.plan, info.profile)
output
--------
1 <neo4j.work.summary.ResultSummary object at 0x000001DB94F1D0D0> <class 'int'> neo4j None None
I get the type of result as ResultSummary
but this object doesn't have any useful info here. This summary clearly says result plan and profile both are None
but actually result should be having information like this as per neo4j desktop browser. Kindly help me to get the result summary.
[
{
"batches": 1,
"total": 8077,
"timeTaken": 0,
"committedOperations": 8077,
"failedOperations": 0,
"failedBatches": 0,
"retries": 0,
"errorMessages": {
},
"batch": {
"total": 1,
"committed": 1,
"failed": 0,
"errors": {
}
},
"operations": {
"total": 8077,
"committed": 8077,
"failed": 0,
"errors": {
}
},
"wasTerminated": false,
"failedParams": {
},
"updateStatistics": {
"nodesDeleted": 8077,
"labelsAdded": 0,
"relationshipsCreated": 0,
"nodesCreated": 0,
"propertiesSet": 0,
"relationshipsDeleted": 14528,
"labelsRemoved": 0
}
}
]