From 88f9e912a29c79e1e25af7982ac6cb2f7d3928b1 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Tue, 7 Nov 2023 18:34:00 +0100 Subject: [PATCH] Deprecate multi-target routing driver 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. --- src/neo4j/_async/driver.py | 9 +++++++++ src/neo4j/_sync/driver.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/neo4j/_async/driver.py b/src/neo4j/_async/driver.py index 33436f59e..596c95c5a 100644 --- a/src/neo4j/_async/driver.py +++ b/src/neo4j/_async/driver.py @@ -381,6 +381,15 @@ def neo4j_driver(cls, *targets, routing_context=None, **config): """ Create a driver for routing-capable Neo4j service access that uses socket I/O and thread-based concurrency. """ + + # TODO: 6.0 - adjust signature to only take one target + if len(targets) > 1: + deprecation_warn( + "Creating a routing driver with multiple targets is " + "deprecated. The driver only uses the first target anyway. " + "The method signature will change in a future release.", + ) + from .._exceptions import ( BoltHandshakeError, BoltSecurityError, diff --git a/src/neo4j/_sync/driver.py b/src/neo4j/_sync/driver.py index bcadeafd2..44f388996 100644 --- a/src/neo4j/_sync/driver.py +++ b/src/neo4j/_sync/driver.py @@ -380,6 +380,15 @@ def neo4j_driver(cls, *targets, routing_context=None, **config): """ Create a driver for routing-capable Neo4j service access that uses socket I/O and thread-based concurrency. """ + + # TODO: 6.0 - adjust signature to only take one target + if len(targets) > 1: + deprecation_warn( + "Creating a routing driver with multiple targets is " + "deprecated. The driver only uses the first target anyway. " + "The method signature will change in a future release.", + ) + from .._exceptions import ( BoltHandshakeError, BoltSecurityError,