Hi,
I am back after 2 years. I was using neo4j driver successfully before, but now it does not return any data. Not sure if there is any changes for this: (I am now using latest neo4j official driver)
with driver.session() as session:
result = session.run("MATCH(n) RETURN n")
print(result.data(), result.single())
[{'n': {}}] None
I have hard research for this and found nothing helpful.
It's working as intended. There is one node that contains no attributes: [{'n': {}}]. Note that after consuming a result, it's empty—like an iterator. So after calling result.data() or doing result_list = list(result), result.single() or repeating one of the above instructions will not give you the same data again. That's why result.single() returns None in your example.
Even if I just only use result.single(), it doesn't return the data. And the data() should result more nodes. There's something wrong I can't get the expected result.
After debugging, I got <neo4j.work.result.Result object, as far as I remember it should return <Node. object. I don't know what's going on.
Finally, I got it working after trying with very new simple python application. What I was doing wrong that printed result in with statement. Rather I have to separate run syntax outside of with session syntax. And printing value there works perfectly.
How does the run work outside the session context? Can you share your sample code?
i have a similar problem where i get result with 4.2 driver but not with 4.3.3 version. Its strange.