In the Neo4j Python code, I have an issue while query from Neo4j DB, with getting below error:
AttributeError: 'Session' object has no attribute 'execute_read'
I want to convert the results of cypher queries into a JSON format.I am using the neo4j python library to connect the graph DB.
Here is my current code:
cypherQuery="MATCH (n:BusinessApplication) RETURN n"
#Run cypher query
with driver.session() as session:
results = session.execute_read(lambda tx: tx.run(cypherQuery).data())
driver.close()
The
session.execute_read
function was introduced in a more recent version of the Neo4j Python driver (5.0) so you may see that error because you're using a previous version of the Neo4j Python driver that does not support that function.You could upgrade to a more recent version 5.0+ of the Neo4j Python driver to use the
execute_read
syntax or use theread_transaction
function instead: