Search code examples
azureazure-cosmosdb

Azure Cosmos python query


We are trying to ping an azure cosmos db in python, which used to work. We are now getting the following error:

[2023-04-21T15:22:15.671Z] gremlin_python.driver.protocol.GremlinServerError: 498:
[2023-04-21T15:22:15.672Z] ActivityId : **-**-**
[2023-04-21T15:22:15.673Z] ExceptionType : GraphMalformedException
[2023-04-21T15:22:15.675Z] ExceptionMessage :
[2023-04-21T15:22:15.676Z]      Gremlin Malformed Request: GraphSON v3 IO is not supported.
[2023-04-21T15:22:15.677Z]      GremlinRequestId : **-**-**
[2023-04-21T15:22:15.678Z]      Context : global
[2023-04-21T15:22:15.679Z]      GraphInterOpStatusCode : M

With the following code:

        client = Client(
            url = cosmos_db_url,
            traversal_source = 'g',
            message_serializer = GraphSONMessageSerializer(),
            username=cosmos_db_graph_path, 
            password=cosmos_primary_key)

Does anyone know what could cause this? I have tried nearly every version of gremlinpython and it is always the same error.


Solution

  • 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.

    GraphSONv3 serializer isn't currently supported. Use GraphSONv2