Connection to Azure cosmos db using Go

Hi All, Asking this as a newbie to Graphs databases in general. I have been trying to connect to an Azure Cosmos Graph database using Apache Tinkerpop SDK for Golang, but am unable to proceed because I can't get past the websocket 1011 error while trying to execute Gremlin queries. Any help would be appreciated.
Solution:
Ah OK - yes. Cosmos DB does not support Gremlin bytecode. It might be worth looking at this documentation: https://learn.microsoft.com/en-us/azure/cosmos-db/gremlin/support They also seem to document that newer Gremlin clients will not work with CosmosDB. I suppose all you can really do is try it. Queries will need to be submitted using the Client.Submit.... type of approach though given "byte code" is not supported....
Azure Cosmos DB for Gremlin support and compatibility with TinkerPo...
Learn about the Gremlin language from Apache TinkerPop. Learn which features and steps are available in Azure Cosmos DB and the TinkerPop Graph engine compatibility differences.
Jump to solution
5 Replies
kelvinl2816
kelvinl28169mo ago
CosmosDB is currently on a quite old (a few years old) version of Gremlin, and as far as I am aware, only supports queries sent as text strings. Can you share an example of how you are trying to establish the connection in Go?
borgirer
borgirer9mo ago
Sure, here is how I'm trying to connect.. I'm using the steps followed in an example connection in this library's pkg.go.dev
No description
Solution
kelvinl2816
kelvinl28169mo ago
Ah OK - yes. Cosmos DB does not support Gremlin bytecode. It might be worth looking at this documentation: https://learn.microsoft.com/en-us/azure/cosmos-db/gremlin/support They also seem to document that newer Gremlin clients will not work with CosmosDB. I suppose all you can really do is try it. Queries will need to be submitted using the Client.Submit.... type of approach though given "byte code" is not supported.
Azure Cosmos DB for Gremlin support and compatibility with TinkerPo...
Learn about the Gremlin language from Apache TinkerPop. Learn which features and steps are available in Azure Cosmos DB and the TinkerPop Graph engine compatibility differences.
borgirer
borgirer9mo ago
Ah I see, I also noticed in some python implementations where this Gremlin client supports an option to set serializer to GraphSONv2, though I couldn't find any such option in go. Seems like my options are very limited then. Are you aware if there is any way I could use this library within go?
spmallette
spmallette9mo ago
gremlin-go is the most modern language variant. so it was focused on bytecode and GraphBinary as the two most modern ways to communicate with the server. as a result, older mechanisms aren't present nor are they built to be particularly extensible. i imagine we'll see more of the old ways disappear as they go through deprecation and the server protocols form around gremlin-language, a tighter type system, etc. i suppose the only way you could try to use it with cosmosdb would be to implement GraphSON and perhaps extend the driver to provide a way to plugin the serializer. i'm not sure if we'd accept that as a pull request or not tbh as i'm not sure we want to maintain that functionality since GraphBinary will likely be the only serializer that language variants support in the future.
Want results from more Discord servers?
Add your server