Py2neo - How do i get node id by node matching

Hello, i'm using py2neo and try to get node id by these code
for rel in matcher.match("SINGLE_NODE"):
print("name:", rel["name"])
print("occur:", rel["occur"])
print("pos:", rel["pos"])

and there is no entity["id"], i want to know anyhow to get id of each node.
thank you

I'm not sure about py2neo but it can sometimes be returned with _ID. If you've placed your own ID on a node you could something like:

MATCH (n:Person {id: yourID}) RETURN ID(n)

which would give you the Neo4j ID of your node

1 Like

from py2neo import Graph
graph = Graph()"MATCH (a:Person) RETURN, LIMIT 4").data()

or if you want only the auto generated node ID
node = graph.evaluate("MATCH (a:Person) RETURN a LIMIT 1")
node_id = node.identity

Some useful links