简体   繁体   English

CypherResults py2neo获取节点对象

[英]CypherResults py2neo get node object

i need to get the id of a node in neo4j using py2neo. 我需要使用py2neo获取neo4j中节点的ID。 using the following query i am getting a cypher result object which contains a record object 使用以下查询,我得到包含记录对象的密码结果对象

table_query = neo4j.CypherQuery(db, "merge (x: Table{name: 'table_param'}) return x")

the contents of the .data method are equal to the following [Record(x=Node('host/db/data/node/31'))] .data方法的内容等于以下[Record(x = Node('host / db / data / node / 31'))]

how can i get the node object 我如何获得节点对象

CypherQuery gives you a CypherResults object if you .execute() it or an IterableCypherResult object if you .stream() it. CypherQuery给你一个CypherResults如果你反对.execute()或一个IterableCypherResult对象,如果你.stream()它。

You can then iterate over the result object: 然后,您可以遍历结果对象:

table_query = neo4j.CypherQuery(db, "merge (x: Table{name: 'table_param'}) return x")
results = table_query.execute()

for r in results:
    # get the node you return in your query
    my_node = r[0]
    # get the properties of your node
    props = my_node.get_properties()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM