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 @@ -1351,6 +1351,12 @@ 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:
from gremlin_python.structure.io.graphsonV3d0 import GraphSONReader

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the import to the top of the file

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