Is Py2neo Caching Burning Me?
Solution 1:
Interesting enough, py2neo 'remembers' the node when you return the node:
MATCH (n:Node) RETURN n
But when you return individual properties, they will always be updated:
MATCH (n:Node) RETURN n.value
For your query that means you have to run my_node.pull()
when you return the same node twice in a while
loop:
while True:
q = "MATCH (n:Node) RETURN n"
result = graph.cypher.execute(q)
my_node = result[0][0]
my_node.pull()
print(my_node)
You can also move everything besides the pull()
out of the loop:
q = "MATCH (n:Node) RETURN n"
result = graph.cypher.execute(q)
my_node = result[0][0]
while True:
my_node.pull()
print(my_node)
Here is a minimal example describing the behaviour: http://paste.ubuntu.com/14015568/
I'm not really sure why py2neo does not return updated node data when you run a new query.
Solution 2:
What do you mean when you say the node's attributes? Do you mean properties? Or are relationships added/removed as well?
What do you expect to get back in r
? Judging from the query, unless the daemon you mention is adding/removing the :XX
label to/from nodes, it'll return exactly the same nodes always.
Post a Comment for "Is Py2neo Caching Burning Me?"