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]))
graph.create(calendar_event)
calendar_rel = Relationship(calendar_event, "POSTED_ON", calendar,
scrape_date=str(datetime.date.today()))
graph.create(calendar_rel)
Warning
/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 is deprecated and is indicated in the source
To solve your issue use NodeSelector equivalent function is NodeSelection.first