gpt4 book ai didi

python - py2neo Graph.find_one() 弃用警告?

转载 作者:太空宇宙 更新时间:2023-11-03 15:33:16 30 4
gpt4 key购买 nike

我在 python 3.5 上安装了 py2neo 版本 3.1.2,当我运行以下代码时,我收到有关 Graph.find_one 的弃用警告,并被告知要使用 NodeSelector。 v3 Documentation没有提到这个折旧。当我在下面的代码中使用 NodeSelector 方法时,我最终会得到许多重复的日历节点,所有节点都链接到单个事件节点。如何更新我的代码以防止出现此警告?

我的图表上已经有许多日历节点。我希望它遍历这个字典并将它们附加到图表中并将它们与适当的日历节点相关联。

for k,v in calendar_dict.items():
calendar = graph.find_one("Calendar", property_key='url', property_value=v[2])
calendar_event = Node("CalendarEvent", event=k, date=str(v[0]))
graph.create(calendar_event)
calendar_rel = Relationship(calendar_event, "POSTED_ON", calendar,
scrape_date=str(datetime.date.today()))
graph.create(calendar_rel)

警告

/home/mcamp/anaconda3/envs/py3.5/lib/python3.5/site-packages/ipykernel/__main__.py:2: DeprecationWarning: Graph.find_one is deprecated, use NodeSelector instead
from ipykernel import kernelapp as app

最佳答案

find_one 已弃用,并在 source 中指出

要解决您的问题,请使用 NodeSelector 等效函数 NodeSelection.first

关于python - py2neo Graph.find_one() 弃用警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42742182/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com