Unable to retrieve routing information
dahwin opened this issue · 0 comments
from neo4j import GraphDatabase, RoutingControl
URI = "neo4j://localhost:7687"
AUTH = ("neo4j", "password")
def add_friend(driver, name, friend_name):
driver.execute_query(
"MERGE (a:Person {name: $name}) "
"MERGE (friend:Person {name: $friend_name}) "
"MERGE (a)-[:KNOWS]->(friend)",
name=name, friend_name=friend_name, database_="neo4j",
)
def print_friends(driver, name):
records, , _ = driver.execute_query(
"MATCH (a:Person)-[:KNOWS]->(friend) WHERE a.name = $name "
"RETURN friend.name ORDER BY friend.name",
name=name, database="neo4j", routing_=RoutingControl.READ,
)
for record in records:
print(record["friend.name"])
with GraphDatabase.driver(URI, auth=AUTH) as driver:
add_friend(driver, "Arthur", "Guinevere")
add_friend(driver, "Arthur", "Lancelot")
add_friend(driver, "Arthur", "Merlin")
print_friends(driver, "Arthur")
im getting this error:
ERROR:neo4j:Unable to retrieve routing information
WARNING:neo4j:Transaction failed and will be retried in 1.0433715829575676s (Unable to retrieve routing information)
ERROR:neo4j:Unable to retrieve routing information
WARNING:neo4j:Transaction failed and will be retried in 1.8409364850162961s (Unable to retrieve routing information)
ERROR:neo4j:Unable to retrieve routing information
WARNING:neo4j:Transaction failed and will be retried in 3.576853554780088s (Unable to retrieve routing information)
ERROR:neo4j:Unable to retrieve routing information
WARNING:neo4j:Transaction failed and will be retried in 8.848266785934904s (Unable to retrieve routing information)
ERROR:neo4j:Unable to retrieve routing information
WARNING:neo4j:Transaction failed and will be retried in 18.717121616388344s (Unable to retrieve routing information)
ERROR:neo4j:Unable to retrieve routing information
ServiceUnavailable Traceback (most recent call last)
in <cell line: 27>()
26
27 with GraphDatabase.driver(URI, auth=AUTH) as driver:
---> 28 add_friend(driver, "Arthur", "Guinevere")
29 add_friend(driver, "Arthur", "Lancelot")
30 add_friend(driver, "Arthur", "Merlin")
10 frames
/usr/local/lib/python3.10/dist-packages/neo4j/_sync/io/_pool.py in update_routing_table(self, database, imp_user, bookmarks, auth, acquisition_timeout, database_callback)
802 # None of the routers have been successful, so just fail
803 log.error("Unable to retrieve routing information")
--> 804 raise ServiceUnavailable("Unable to retrieve routing information")
805
806 def update_connection_pool(self, *, database):
ServiceUnavailable: Unable to retrieve routing information
how to fix it?