Skip to content

Commit 5fad60d

Browse files
authored
Add warnings for usage of %%oc with incompatible Neptune Analytics parameters (#599)
* Add warnings and improve help docs for Neptune Analytics %%oc parameters * update changelog
1 parent 54883da commit 5fad60d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Starting with v1.31.6, this file will contain a record of major features and upd
77
- New notebooks showing Telco examples leveraging GNN and LLM ([Link to PR](https://github.com/aws/graph-notebook/pull/587))
88
- Path: 02-Neptune-ML > 03-Sample-Applications > 04-Telco-Networks
99
- Added KMS encryption support to NeptuneDB Notebook CloudFormation template ([Link to PR](https://github.com/aws/graph-notebook/pull/590))
10+
- Added warnings for usage of `%%oc` with incompatible Neptune Analytics parameters ([Link to PR](https://github.com/aws/graph-notebook/pull/599))
1011
- Improved handling of mixed type Gremlin results ([Link to PR](https://github.com/aws/graph-notebook/pull/592))
1112
- Updated to `rdflib==7.0.0` and `SPARQLWrapper==2.0.0` ([Link to PR](https://github.com/aws/graph-notebook/pull/596))
1213
- Fixed formatting of query magic `--help` entries listing valid inputs ([Link to PR](https://github.com/aws/graph-notebook/pull/593))

src/graph_notebook/magics/graph_magic.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,9 +3036,10 @@ def handle_opencypher_query(self, line, cell, local_ns):
30363036
"""
30373037
parser = argparse.ArgumentParser()
30383038
parser.add_argument('-pc', '--plan-cache', type=str.lower, default='auto',
3039-
help=f'Plan cache mode to use. Accepted values: {OPENCYPHER_PLAN_CACHE_MODES}')
3039+
help=f'Neptune Analytics only. Specifies the plan cache mode to use. '
3040+
f'Accepted values: {OPENCYPHER_PLAN_CACHE_MODES}')
30403041
parser.add_argument('-qt', '--query-timeout', type=int, default=None,
3041-
help=f'Maximum query timeout in milliseconds.')
3042+
help=f'Neptune Analytics only. Specifies the maximum query timeout in milliseconds.')
30423043
parser.add_argument('--explain-type', type=str.lower, default='dynamic',
30433044
help=f'Explain mode to use when using the explain query mode. '
30443045
f'Accepted values: {OPENCYPHER_EXPLAIN_MODES}')
@@ -3142,6 +3143,12 @@ def handle_opencypher_query(self, line, cell, local_ns):
31423143
first_tab_html = opencypher_explain_template.render(table=explain,
31433144
link=f"data:text/html;base64,{base64_str}")
31443145
elif args.mode == 'query':
3146+
if not self.client.is_analytics_domain():
3147+
if args.plan_cache != 'auto':
3148+
print("planCache is not supported for Neptune DB, ignoring.")
3149+
if args.query_timeout is not None:
3150+
print("queryTimeoutMilliseconds is not supported for Neptune DB, ignoring.")
3151+
31453152
query_start = time.time() * 1000 # time.time() returns time in seconds w/high precision; x1000 to get in ms
31463153
oc_http = self.client.opencypher_http(cell, query_params=query_params,
31473154
plan_cache=args.plan_cache,

0 commit comments

Comments
 (0)