How do i use GraphSON v2 instead of v3?

1

i am trying to run a piece of code in python which uses Cosmos DB from Microsoft Azure. I am currently using gremlinpython 3.2.6 and the latest version of Cosmos (default on microsoft azure) but there seems to be some compatibility issues between the two.

When i run my code i get the following error;

GremlinServerError: 498: 

ActivityId : 5c05bb15-3aa1-41b8-9c10-ab3015152eab
ExceptionType : GraphMalformedException
ExceptionMessage :
    Gremlin Malformed Request: GraphSON v3 IO is not supported.
    GremlinRequestId : 5c05bb15-3aa1-41b8-9c10-ab3015152eab
    Context : global
    GraphInterOpStatusCode : MalformedRequest
    HResult : 0x80131500

I have read that I should try using GraphSON v2 instead of V3 but don't know how, can anyone help?

python
azure
azure-cosmosdb
graphson
asked on Stack Overflow Mar 16, 2020 by NoobCoder

3 Answers

0

welcome to this community. You just need to ensure that you use the schema of the GraphSON v2, since it is the version supported in Azure Cosmos DB. Check the json you are using and ensure that follows the supported schema. You have some examples in this link.

answered on Stack Overflow Mar 16, 2020 by Hugo Barona
0

By default gremlin_python uses the GraphSONSerializersV3d0, so you have to explicitly pass the GraphSONSerializersV2d0 when creating the client:

from gremlin_python.driver import client, serializer

client.Client(
    message_serializer=serializer.GraphSONSerializersV2d0(),
    password="...",
    traversal_source='g',
    url='wss://...:443/',
    username="/dbs/.../colls/...",
)
answered on Stack Overflow Aug 11, 2020 by Heye
0

Provide it as mime type when you create client

var client = new GremlinClient(gremlinServer:gremlinServer,mimeType:GremlinClient.GraphSON2MimeType)
answered on Stack Overflow Dec 28, 2020 by Rajesh Dhiman • edited Dec 28, 2020 by Gautham M

User contributions licensed under CC BY-SA 3.0