Matt Camp Matt Camp - 1 year ago 214
Python Question

py2neo Graph.find_one() deprecation warning?

I have py2neo version 3.1.2 installed on python 3.5 and when I run the following code, I receive a deprecation warning about Graph.find_one and am told to use NodeSelector instead. v3 Documentation doesn't mention this depreciation. When I go to use the NodeSelector method in the code below I end up with many duplicate calendar nodes all linked to a single event node. How do I update my code to prevent this warning?

There are already a number of calendar nodes on my graph. I want this to go through this dictionary and append them to the graph and relate them to the appropriate calendar node.

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]))
calendar_rel = Relationship(calendar_event, "POSTED_ON", calendar,


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

Answer Source

find_one is deprecated and is indicated in the source

To solve your issue use NodeSelector equivalent function is NodeSelection.first

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download