Skip to content

Commit a075e40

Browse files
4.1 new bolt version init (#433)
* Python Aura Example (#431) * aura example * aura example * add placeholders * update link * addressing martin's feedback * remove another tag * remove f string * rename to be more generic * add tags * initiated the 4.1 bolt protocol Co-authored-by: Mark Needham <m.h.needham@gmail.com>
1 parent b999638 commit a075e40

File tree

6 files changed

+563
-5
lines changed

6 files changed

+563
-5
lines changed

neo4j/io/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@ def protocol_handlers(cls, protocol_version=None):
135135
# Carry out Bolt subclass imports locally to avoid circular dependency issues.
136136
from neo4j.io._bolt3 import Bolt3
137137
from neo4j.io._bolt4x0 import Bolt4x0
138+
from neo4j.io._bolt4x1 import Bolt4x1
138139

139140
handlers = {
140141
Bolt3.PROTOCOL_VERSION: Bolt3,
141-
Bolt4x0.PROTOCOL_VERSION: Bolt4x0
142+
Bolt4x0.PROTOCOL_VERSION: Bolt4x0,
143+
Bolt4x1.PROTOCOL_VERSION: Bolt4x1,
142144
}
143145

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

654661
from neo4j.api import (
655662
SYSTEM_DATABASE,
@@ -686,7 +693,7 @@ def fail(md):
686693
on_success=metadata.update,
687694
on_failure=fail,
688695
)
689-
elif cx.PROTOCOL_VERSION == Bolt4x0.PROTOCOL_VERSION:
696+
elif cx.PROTOCOL_VERSION in (Bolt4x0.PROTOCOL_VERSION, Bolt4x1.PROTOCOL_VERSION):
690697
if database == DEFAULT_DATABASE:
691698
cx.run(
692699
"CALL dbms.routing.getRoutingTable($context)",

0 commit comments

Comments
 (0)