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:Jump to 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.
5 Replies
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?
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](https://cdn.answeroverflow.com/1194739326777557183/gremlin_error.png)
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.
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?
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.