Unable to deserialize results with Gremlin-go client + JanusGraph
Hi all - I'm trying to set up a JanusGraph database and use the Gremlin-go client to run some gremlin traversals over it. I'm facing some serialization error.
My docker-compose file to start a JanusGraph at
localhost:8182
:
My minimal example Golang code that is not working:
Solution:Jump to solution
For Python, you can also use JanusGraph-Python to get better support for JanusGraph types: https://github.com/JanusGraph/janusgraph-python
(JanusGraph-Python only extends Gremlin-Python so you will still be using that. It just adds serializers for JanusGraph types)...
GitHub
GitHub - JanusGraph/janusgraph-python: JanusGraph Python Gremlin La...
JanusGraph Python Gremlin Language Variant (GLV). Contribute to JanusGraph/janusgraph-python development by creating an account on GitHub.
10 Replies
Output (at I didn't have the above issue if I used the Gremlin-go's bytecode APIs (i.e., not a string, but constructing steps within Golang).
- The above code also didn't have any issue when connecting to Tinkerpop or Neptune instead of JanusGraph.
- The same query under the groovy console works.
Ran into the same error using Gremlin-go's bytecode APIs:
I noticed in gremlin_python, I faced the same issue, but I was able to fix it by setting
result.All()
):
Some notes:
- message_serializer=serializer.GraphSONMessageSerializer()
in the DriverRemoteConnection
to fix it. The issue seems to come from the default binary serializer after reading some Github Issues and the general channel. I suspect the issue is with the serializer my Golang code uses (the binary one), but I have no idea how it could be set to another serializer (Graphson) like gremlin_python does. Does anyone have some clue how to change the serializer in gremlin-go? Thanks!can someone who knows @janusgraph help on this one?
One note on gremlin-go, it only supports the graphBinary serialization format, so there is no way to change the serializer. Not sure if folks from JanusGraph know any workaround?
really need to get rid of the need for custom serializers in the future. it's too much burden on providers to have to build them and too complicated for users to figure them out. providers should make sure that their ids can be coerced to/from string or otherwise operate with the set of datatypes TinkerPop allows.
@zlfben As a workaround - could you try JanusGraph 0.6.3?
providers should make sure that their ids can be coerced to/from stringThat will be a huge breaking change 😦
Thanks. Just tried JanusGraph 0.6.3. With out of box configuration it worked well with gremlin-go's graphBinary serialization. However, it doesn't support my old configuration (shown below). After setting these for the JanusGraph, it seemed to have a lot of issues setting any types of vertex ids (long, string, etc.). I do need to use UUID as my vertex IDs - is there any way to configure JanusGraph 0.6.3 to support that, or is it only available in 1.0 or later?
I do need to use UUID as my vertex IDs - is there any way to configure JanusGraph 0.6.3 to support that, or is it only available in 1.0 or laterThat's only supported in 1.0 😦
Thanks for the replies! In the end I just built a small gremlin broker using gremlin_python + Graphson serializer and called the broker in my Golang code. Hopefully future updates of gremlin-go or JanusGraph can solve this issue.🤞
Solution
For Python, you can also use JanusGraph-Python to get better support for JanusGraph types: https://github.com/JanusGraph/janusgraph-python
(JanusGraph-Python only extends Gremlin-Python so you will still be using that. It just adds serializers for JanusGraph types)
GitHub
GitHub - JanusGraph/janusgraph-python: JanusGraph Python Gremlin La...
JanusGraph Python Gremlin Language Variant (GLV). Contribute to JanusGraph/janusgraph-python development by creating an account on GitHub.
And if you want to continue Go, then maybe you are interested in implementing basic support for JanusGraph types yourself there?
In that case you could check out the GraphBinary support for JanusGraph in JanusGraph.Net: https://github.com/JanusGraph/janusgraph-dotnet/tree/master/src/JanusGraph.Net/IO/GraphBinary
to get an idea of what needs to be implemented.
Most types are even optional, e.g., you don't need support for Geoshapes / Point if you aren't using those
GitHub
janusgraph-dotnet/src/JanusGraph.Net/IO/GraphBinary at master · Jan...
JanusGraph .NET Gremlin Language Variant (GLV). Contribute to JanusGraph/janusgraph-dotnet development by creating an account on GitHub.