簡體   English   中英

CypherResults py2neo獲取節點對象

[英]CypherResults py2neo get node object

我需要使用py2neo獲取neo4j中節點的ID。 使用以下查詢,我得到包含記錄對象的密碼結果對象

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

.data方法的內容等於以下[Record(x = Node('host / db / data / node / 31'))]

我如何獲得節點對象

CypherQuery給你一個CypherResults如果你反對.execute()或一個IterableCypherResult對象,如果你.stream()它。

然后,您可以遍歷結果對象:

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