Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions neo4j/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ def protocol_handlers(cls, protocol_version=None):
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
from neo4j.io._bolt3 import Bolt3
from neo4j.io._bolt4x0 import Bolt4x0
from neo4j.io._bolt4x1 import Bolt4x1

handlers = {
Bolt3.PROTOCOL_VERSION: Bolt3,
Bolt4x0.PROTOCOL_VERSION: Bolt4x0
Bolt4x0.PROTOCOL_VERSION: Bolt4x0,
Bolt4x1.PROTOCOL_VERSION: Bolt4x1,
}

if protocol_version is None:
Expand Down Expand Up @@ -203,6 +205,10 @@ def open(cls, address, *, auth=None, timeout=None, **pool_config):
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
from neo4j.io._bolt4x0 import Bolt4x0
connection = Bolt4x0(address, s, pool_config.max_connection_lifetime, auth=auth, user_agent=pool_config.user_agent)
elif pool_config.protocol_version == (4, 1):
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
from neo4j.io._bolt4x1 import Bolt4x1
connection = Bolt4x1(address, s, pool_config.max_connection_lifetime, auth=auth, user_agent=pool_config.user_agent)
else:
log.debug("[#%04X] S: <CLOSE>", s.getpeername()[1])
s.shutdown(SHUT_RDWR)
Expand Down Expand Up @@ -650,6 +656,7 @@ def fetch_routing_info(self, *, address, timeout, database):
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
from neo4j.io._bolt3 import Bolt3
from neo4j.io._bolt4x0 import Bolt4x0
from neo4j.io._bolt4x1 import Bolt4x1

from neo4j.api import (
SYSTEM_DATABASE,
Expand Down Expand Up @@ -686,7 +693,7 @@ def fail(md):
on_success=metadata.update,
on_failure=fail,
)
elif cx.PROTOCOL_VERSION == Bolt4x0.PROTOCOL_VERSION:
elif cx.PROTOCOL_VERSION in (Bolt4x0.PROTOCOL_VERSION, Bolt4x1.PROTOCOL_VERSION):
if database == DEFAULT_DATABASE:
cx.run(
"CALL dbms.routing.getRoutingTable($context)",
Expand Down
Loading