Skip to content

Commit

Permalink
Use /queries endpoint for %%oc
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnchin committed Oct 1, 2024
1 parent 7f02355 commit 1b3c5ee
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/graph_notebook/neptune/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,23 +541,31 @@ def opencypher_http(self, query: str, headers: dict = None, explain: str = None,
if headers is None:
headers = {}

url = f'{self._http_protocol}://{self.host}:{self.port}/'
url = f'{self._http_protocol}://{self.host}'

if self.is_neptune_domain():
if 'content-type' not in headers:
headers['content-type'] = 'application/x-www-form-urlencoded'
url += 'openCypher'
data = {}
if self.is_analytics_domain():
url += f'/queries'
data['language'] = 'opencypher'
else:
if 'content-type' not in headers:
headers['content-type'] = 'application/x-www-form-urlencoded'
url += f':{self.port}/openCypher'
if plan_cache:
if plan_cache not in OPENCYPHER_PLAN_CACHE_MODES:
print('Invalid --plan-cache mode specified, defaulting to auto.')
else:
if self.is_analytics_domain():
data['planCache'] = plan_cache
elif plan_cache != 'auto':
query = set_plan_cache_hint(query, plan_cache)
if plan_cache != 'auto':
if self.is_analytics_domain():
data['planCache'] = plan_cache
else:
query = set_plan_cache_hint(query, plan_cache)
data['query'] = query
if explain:
if self.is_analytics_domain():
data['explain.mode'] = explain
data['explain-mode'] = explain
data['explain'] = explain
headers['Accept'] = "text/html"
if query_params:
Expand Down

0 comments on commit 1b3c5ee

Please sign in to comment.