1
votes

I'm trying to get the node property in python, which I earlier created with name property as Marco

student = db.labels.create("Student")
u1 = db.nodes.create(name="Marco")
student.add(u1)

When I queried on neo4j UI using query

MATCH (n:Student) where n.name="gaurav" RETURN n.name

It returned me property of the node.

But how do I get same property in python, presently I'm using below script to query the DB, but I dont know how to get property name from this query sequence.

result = db.query("MATCH (a:Student) WHERE a.name = {} RETURN a ", {"name": 
"Marco"}, returns=(client.Node))
1

1 Answers

0
votes

As explained in https://marcobonzanini.com/2015/04/06/getting-started-with-neo4j-and-python/ you can do this :

results = db.query("MATCH (a:Student) WHERE a.name = {} RETURN a ", {"name": 
"Marco"}, returns=(client.Node))

for r in results:
    print("(%s)" % (r[0]["name"]))

Hope this helps, Tom