[英]Py2neo updateing existing node
我一直在嘗試使用 py2neo 更新現有節點。 一些值得一提的事情:
OS: Arch Linux x86_64
python version: 3.8
py2neo version: 2021.0.1
ne4j version: 4.2.1
flask version: 1.1.2
Application is running inside a docker container, the actual flask website is on port 5000, neo4j interface is on port 7474 and flask connects to port 7687 (neo4j)
以下是我嘗試過的幾種方法:
1)
def update_node(self, node_name: str, node_group: str, property_update: dict):
return self.name_search_person(node_name=node_name, node_group=node_group).update(**property_update)
def update_node(self, node_name: str, node_group: str, property_update: dict):
node_to_update = self.name_search_person(node_name=node_name, node_group=node_group)
if node_to_update:
node_to_update.update(**property_update)
self.g.push(node_to_update)
del node_to_update
return 'successfully updated node'
在第二種方法中,我嘗試了以下 function 調用:
graph_db.update_node(node_name='Andrei', node_group='Person', property_update={'name': t['Updated']})
(這只是返回 NameError: name 't' is not defined(我在這里看到過)
和
graph_db.update_node(node_name='Andrei', node_group='Person', property_update={'name':'Updated'})
我對 function 調用做錯了什么,還是實際更新 function 由於某種原因無法正常工作?
顯然解決方案是從 function 調用中刪除“t”
graph_db.update_node(node_name='Andrei', node_group='Person', property_update={'name': t['Updated']}
所以現在是:
graph_db.update_node(node_name='Andrei', node_group='Person', property_update={'name': ['Updated']}
老實說 IDK 為什么它不能與其他 function 通話一起使用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.