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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
- `ERROR_REWRITE_MAP`
- `client_errors`
- `transient_errors`

- Raise `ConfigurationError` instead of ignoring the routing context (URI query parameters) when creating a direct
driver ("bolt[+s[sc]]://" scheme).

## Version 5.28
- Since the types of `Relationship`s are tied to the `Graph` object they belong to, fixing `pickle` support for graph types means that `Relationship`s with the same name will have a different type after `deepcopy`ing or pickling and unpickling them or their graph.
Expand Down
15 changes: 4 additions & 11 deletions src/neo4j/_async/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +277,11 @@ def driver(
assert driver_type in {DRIVER_BOLT, DRIVER_NEO4J}
if driver_type == DRIVER_BOLT:
if parse_routing_context(parsed.query):
deprecation_warn(
'Creating a direct driver ("bolt://" scheme) with '
"routing context (URI parameters) is deprecated. They "
"will be ignored. This will raise an error in a "
f'future release. Given URI "{uri}"',
stack_level=2,
raise ConfigurationError(
"Routing context (URI query parameters) are not "
"supported by direct drivers "
f'("bolt[+s[sc]]://" scheme). Given URI: {uri!r}.'
)
# TODO: 6.0 - raise instead of warning
# raise ValueError(
# 'Routing parameters are not supported with scheme '
# '"bolt". Given URI "{}".'.format(uri)
# )
return cls.bolt_driver(parsed.netloc, **config)
# else driver_type == DRIVER_NEO4J
routing_context = parse_routing_context(parsed.query)
Expand Down
15 changes: 4 additions & 11 deletions src/neo4j/_sync/driver.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/unit/async_/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ async def test_direct_driver_constructor(
):
uri = protocol + host + port + params
if params:
with pytest.warns(DeprecationWarning, match="routing context"):
driver = AsyncGraphDatabase.driver(uri, auth=auth_token)
with pytest.raises(ConfigurationError, match="Routing context"):
AsyncGraphDatabase.driver(uri, auth=auth_token)
else:
driver = AsyncGraphDatabase.driver(uri, auth=auth_token)
assert isinstance(driver, AsyncBoltDriver)
await driver.close()
await driver.close()
assert isinstance(driver, AsyncBoltDriver)


@pytest.mark.parametrize(
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/sync/test_driver.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.