Skip to content

Commit

Permalink
added reference to JanusGraph-Python package
Browse files Browse the repository at this point in the history
Signed-off-by: pm-osc <[email protected]>
  • Loading branch information
pm-osc authored and porunov committed Jan 12, 2025
1 parent 0f4dd57 commit 5366ccc
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion docs/basics/connecting/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,38 @@ print(f'Hercules is {hercules_age} years old.')
`next()` is a terminal step that submits the traversal to the
Gremlin Server and returns a single result.

## JanusGraph Specific Types and Predicates
## JanusGraph-Python for JanusGraph Specific Types and Predicates

JanusGraph contains some types and [predicates](../search-predicates.md) that
are not part of Apache TinkerPop and are therefore also not supported by
Gremlin-Python.
[JanusGraph-Python](https://github.com/JanusGraph/janusgraph-python) is a Python
package that adds support for some of these types and predicates to Gremlin-Python.

After installing the package, a message serializer needs to be configured for
JanusGraph which can be done like this for GraphSON 3:

```python
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from janusgraph_python.driver.serializer import JanusGraphSONSerializersV3d0

connection = DriverRemoteConnection(
'ws://localhost:8182/gremlin', 'g',
message_serializer=JanusGraphSONSerializersV3d0())
```

or like this for GraphBinary:

```python
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from janusgraph_python.driver.serializer import JanusGraphBinarySerializersV1

connection = DriverRemoteConnection(
'ws://localhost:8182/gremlin', 'g',
message_serializer=JanusGraphBinarySerializersV1())
```

Refer to [the documentation of JanusGraph-Python](https://github.com/JanusGraph/janusgraph-python#janusgraph-python)
for more information about the package, including its [compatibility with
different JanusGraph versions](https://github.com/JanusGraph/janusgraph-python#version-compatibility)
and differences in support between the different [serialization formats](https://github.com/JanusGraph/janusgraph-python#serialization-formats).

0 comments on commit 5366ccc

Please sign in to comment.