Skip to content

Commit 153fbf7

Browse files
authored
Deprecate multi-target routing driver (#986)
Frankly, the deprecation might be overkill. When constructing a driver via `GraphDatabase.driver(...)`, you cannot run into this case, but only when using the undocumented and cumbersome `GraphDatabase.neo4j_driver(...)` method. Even then, the driver will ignore everything but the first target.
1 parent 65b0b4d commit 153fbf7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/neo4j/_async/driver.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,15 @@ def neo4j_driver(cls, *targets, routing_context=None, **config):
381381
""" Create a driver for routing-capable Neo4j service access
382382
that uses socket I/O and thread-based concurrency.
383383
"""
384+
385+
# TODO: 6.0 - adjust signature to only take one target
386+
if len(targets) > 1:
387+
deprecation_warn(
388+
"Creating a routing driver with multiple targets is "
389+
"deprecated. The driver only uses the first target anyway. "
390+
"The method signature will change in a future release.",
391+
)
392+
384393
from .._exceptions import (
385394
BoltHandshakeError,
386395
BoltSecurityError,

src/neo4j/_sync/driver.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,15 @@ def neo4j_driver(cls, *targets, routing_context=None, **config):
380380
""" Create a driver for routing-capable Neo4j service access
381381
that uses socket I/O and thread-based concurrency.
382382
"""
383+
384+
# TODO: 6.0 - adjust signature to only take one target
385+
if len(targets) > 1:
386+
deprecation_warn(
387+
"Creating a routing driver with multiple targets is "
388+
"deprecated. The driver only uses the first target anyway. "
389+
"The method signature will change in a future release.",
390+
)
391+
383392
from .._exceptions import (
384393
BoltHandshakeError,
385394
BoltSecurityError,

0 commit comments

Comments
 (0)