Skip to content

Commit f087157

Browse files
authored
Enable query timeout for Neptune Analytics explains (#701)
* Enable query timeout for Neptune Analytics explains * update changelog
1 parent 1397a77 commit f087157

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Starting with v1.31.6, this file will contain a record of major features and upd
44

55
## Upcoming
66

7+
- Enabled `--query-timeout` on `%%oc explain` for Neptune Analytics ([Link to PR](https://github.com/aws/graph-notebook/pull/701))
8+
79
## Release 4.6.0 (September 19, 2024)
810

911
- Updated Gremlin config `message_serializer` to accept all TinkerPop serializers ([Link to PR](https://github.com/aws/graph-notebook/pull/685))

src/graph_notebook/magics/graph_magic.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3597,8 +3597,11 @@ def handle_opencypher_query(self, line, cell, local_ns):
35973597

35983598
if args.mode == 'explain':
35993599
query_start = time.time() * 1000 # time.time() returns time in seconds w/high precision; x1000 to get in ms
3600-
res = self.client.opencypher_http(cell, explain=args.explain_type, query_params=query_params,
3601-
plan_cache=args.plan_cache)
3600+
res = self.client.opencypher_http(cell,
3601+
explain=args.explain_type,
3602+
query_params=query_params,
3603+
plan_cache=args.plan_cache,
3604+
query_timeout=args.query_timeout)
36023605
query_time = time.time() * 1000 - query_start
36033606
res_replace_chars = res.content.replace(b'$', b'\$')
36043607
explain = res_replace_chars.decode("utf-8")
@@ -3617,7 +3620,8 @@ def handle_opencypher_query(self, line, cell, local_ns):
36173620
print("queryTimeoutMilliseconds is not supported for Neptune DB, ignoring.")
36183621

36193622
query_start = time.time() * 1000 # time.time() returns time in seconds w/high precision; x1000 to get in ms
3620-
oc_http = self.client.opencypher_http(cell, query_params=query_params,
3623+
oc_http = self.client.opencypher_http(cell,
3624+
query_params=query_params,
36213625
plan_cache=args.plan_cache,
36223626
query_timeout=args.query_timeout)
36233627
query_time = time.time() * 1000 - query_start

0 commit comments

Comments
 (0)