Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/graph_notebook/magics/graph_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from botocore.session import get_session
from gremlin_python.driver.protocol import GremlinServerError
from gremlin_python.structure.graph import Path
from gremlin_python.structure.io.graphsonV3d0 import GraphSONReader
from IPython.core.display import HTML, display_html, display
from IPython.core.magic import (Magics, magics_class, cell_magic, line_magic, line_cell_magic, needs_local_scope)
from ipywidgets.widgets.widget_description import DescriptionStyle
Expand Down Expand Up @@ -1351,6 +1352,11 @@ def gremlin(self, line, cell, local_ns: dict = None):
query_res_http_json = json.loads(query_res_fixed)
if 'result' in query_res_http_json:
query_res = query_res_http_json['result']['data']
# Handle typed GraphSON format where data is {"@type": "g:List", "@value": [...]}
if isinstance(query_res, dict) and '@type' in query_res and '@value' in query_res:
reader = GraphSONReader()
query_res = reader.to_object(query_res)
using_http = False # results are now deserialized objects like WS path
else:
if 'reason' in query_res_http_json:
logger.debug('Query failed with internal error, see response.')
Expand Down
2 changes: 1 addition & 1 deletion src/graph_notebook/neptune/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
GREMLIN_SERIALIZERS_HTTP = [GRAPHSONV1, GRAPHSONV1_UNTYPED, GRAPHSONV2_UNTYPED, GRAPHSONV3_UNTYPED]
GREMLIN_SERIALIZERS_HTTP_NEXT = [GRAPHSONV4, GRAPHSONV4_UNTYPED]
GREMLIN_SERIALIZERS_ALL = GREMLIN_SERIALIZERS_WS + GREMLIN_SERIALIZERS_HTTP + GREMLIN_SERIALIZERS_HTTP_NEXT
NEPTUNE_GREMLIN_SERIALIZERS_HTTP = [GRAPHSONV1_UNTYPED, GRAPHSONV2_UNTYPED, GRAPHSONV3_UNTYPED]
NEPTUNE_GREMLIN_SERIALIZERS_HTTP = [GRAPHSONV1_UNTYPED, GRAPHSONV2_UNTYPED, GRAPHSONV3_UNTYPED, GRAPHSONV3]
NEPTUNE_GREMLIN_SERIALIZERS_HTTP_NEXT = NEPTUNE_GREMLIN_SERIALIZERS_HTTP + [GRAPHSONV4_UNTYPED]
DEFAULT_GREMLIN_WS_SERIALIZER = GRAPHSONV3
DEFAULT_GREMLIN_HTTP_SERIALIZER = GRAPHSONV3_UNTYPED
Expand Down
Loading