Skip to content

Commit 5b0a5ad

Browse files
authored
Raise error on bolt URI with routing context (#645)
1 parent 423e1e5 commit 5b0a5ad

File tree

3 files changed

+46
-34
lines changed

3 files changed

+46
-34
lines changed

CHANGELOG.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,42 @@
1616
Use `trusted_certificates` instead which expects `None` or a `list`. See the
1717
API documentation for more details.
1818
- `neo4j.time` module:
19-
- `Duration`
20-
- The constructor does not accept `subseconds` anymore.
21-
Use `milliseconds`, `microseconds`, or `nanoseconds` instead.
22-
- The property `subseconds` has been removed.
23-
Use `nanoseconds` instead.
24-
- The property `hours_minutes_seconds` has been removed.
25-
Use `hours_minutes_seconds_nanoseconds` instead.
26-
- For all math operations holds: they are element-wise on
27-
(`months`, `days`, `nanoseconds`).
28-
This affects (i.e., changes) the working of `//`, `%`, `/`, and `*`.
29-
- Years are equal to 12 months.
30-
- Weeks are equal to 7 days.
31-
- `seconds`, `milliseconds`, `microseconds`, and `nanoseconds` are
32-
implicitly converted to `nanoseconds` or `seconds` as fit.
33-
- Multiplication and division allow for floats but will always result in
34-
integer values (round to nearest even).
35-
- `Time`
36-
- The constructor does not accept `float`s for `second` anymore.
37-
Use `nanosecond` instead.
38-
- Ticks are now nanoseconds since midnight (`int`).
39-
- The property `ticks_ns` has been renamed to `ticks`.
40-
The old `ticks` is no longer supported.
41-
- The property`from_ticks_ns` has been renamed to `from_ticks`.
42-
The old `from_ticks` is no longer supported.
43-
- The property `second` returns an `int` instead of a `float`.
44-
Use `nanosecond` to get the sub-second information.
45-
- The property `hour_minute_second` has been removed.
46-
Use `hour_minute_second_nanosecond` instead.
47-
- `DateTime`
48-
- The property `hour_minute_second` has been removed.
49-
Use `hour_minute_second_nanosecond` instead.
50-
- The property `second` returns an `int` instead of a `float`.
51-
Use `nanosecond` to get the sub-second information.
52-
19+
- `Duration`
20+
- The constructor does not accept `subseconds` anymore.
21+
Use `milliseconds`, `microseconds`, or `nanoseconds` instead.
22+
- The property `subseconds` has been removed.
23+
Use `nanoseconds` instead.
24+
- The property `hours_minutes_seconds` has been removed.
25+
Use `hours_minutes_seconds_nanoseconds` instead.
26+
- For all math operations holds: they are element-wise on
27+
(`months`, `days`, `nanoseconds`).
28+
This affects (i.e., changes) the working of `//`, `%`, `/`, and `*`.
29+
- Years are equal to 12 months.
30+
- Weeks are equal to 7 days.
31+
- `seconds`, `milliseconds`, `microseconds`, and `nanoseconds` are
32+
implicitly converted to `nanoseconds` or `seconds` as fit.
33+
- Multiplication and division allow for floats but will always result in
34+
integer values (round to nearest even).
35+
- `Time`
36+
- The constructor does not accept `float`s for `second` anymore.
37+
Use `nanosecond` instead.
38+
- Ticks are now nanoseconds since midnight (`int`).
39+
- The property `ticks_ns` has been renamed to `ticks`.
40+
The old `ticks` is no longer supported.
41+
- The property`from_ticks_ns` has been renamed to `from_ticks`.
42+
The old `from_ticks` is no longer supported.
43+
- The property `second` returns an `int` instead of a `float`.
44+
Use `nanosecond` to get the sub-second information.
45+
- The property `hour_minute_second` has been removed.
46+
Use `hour_minute_second_nanosecond` instead.
47+
- `DateTime`
48+
- The property `hour_minute_second` has been removed.
49+
Use `hour_minute_second_nanosecond` instead.
50+
- The property `second` returns an `int` instead of a `float`.
51+
Use `nanosecond` to get the sub-second information.
52+
- Creation of a driver with `bolt[+s[sc]]://` scheme now raises an error if the
53+
URI contains a query part (a routing context). Previously, the routing context
54+
was silently ignored.
5355

5456
## Version 4.4
5557

neo4j/_async/driver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ def driver(cls, uri, *, auth=None, **config):
8787
config["trusted_certificates"] = []
8888

8989
if driver_type == DRIVER_BOLT:
90+
if parse_routing_context(parsed.query):
91+
raise ValueError(
92+
'Routing parameters are not supported with scheme "bolt". '
93+
'Given URI "{}".'.format(uri)
94+
)
9095
return cls.bolt_driver(parsed.netloc, auth=auth, **config)
9196
elif driver_type == DRIVER_NEO4j:
9297
routing_context = parse_routing_context(parsed.query)

neo4j/_sync/driver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ def driver(cls, uri, *, auth=None, **config):
8787
config["trusted_certificates"] = []
8888

8989
if driver_type == DRIVER_BOLT:
90+
if parse_routing_context(parsed.query):
91+
raise ValueError(
92+
'Routing parameters are not supported with scheme "bolt". '
93+
'Given URI "{}".'.format(uri)
94+
)
9095
return cls.bolt_driver(parsed.netloc, auth=auth, **config)
9196
elif driver_type == DRIVER_NEO4j:
9297
routing_context = parse_routing_context(parsed.query)

0 commit comments

Comments
 (0)