I'm using py2neo 3.1.2 version with Neo4j 3.2.0 and I have a question about it. At Neo4J's web interface I can run the following query to get the nodes ids:
MATCH (n:Person) RETURN ID(n)
I'd like to know if there's something at py2neo API that does that same thing. I've already inspected the Node
object, but I couldn't find anything about it.
I've talked with @technige at Twitter (py2neo's creator) and his answer was.
Ah right. It's a bit indirect but you can do:
from py2neo import remote remote(node)._id
Update: Previous Answer does not work with new
py2neo
but this answer worksThe current version of
py2neo
(4.0.0b12) dropped theremote
method. Now you can get theNODE ID
by accessing thepy2neo.data.Node.identity
attribute. It's quite simple. Let's say I query myneo4j
database usingpy2neo
like this:We can confirm the NODE ID by querying our database using the node id returned by the attribute. If it worked correctly,
a
andb
should be the same node. Let's do a test: