Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-26-2019 08:43 PM
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
12-30-2019 05:35 AM
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
01-28-2020 08:33 AM
from py2neo import Graph
graph = Graph()
graph.run("MATCH (a:Person) RETURN a.name, a.id 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
https://py2neo.org/v4/database.html
All the sessions of the conference are now available online