I Have created a graph using gremlin console
gremlin> ConfiguredGraphFactory.graphNames
==>MYGRAPH
gremlin> ConfiguredGraphFactory.getConfiguration('MYGRAPH')
==>storage.backend=cql
==>graph.graphname=MYGRAPH
==>storage.hostname=127.0.0.1
==>Template_Configuration=false
gremlin> g.V().properties()
==>vp[name->SFO]
==>vp[country->USA]
==>vp[name->ALD]
==>vp[country->IND]
==>vp[name->BLR]
==>vp[country->IND]
gremlin>
I want to connect with MYGRAPH using gremlin-python. Can someone please tell me how to access graph named "MYGRAPH" using gremlin-python.
Thanks in advance...
First of all you will need to install some jar files for JanusGraph to handle gremlin-python scripts:
Please note that the version of gremlin-python you install must match the Tinkerpop version JanusGraph is compatible with. You can find compatibility information on the JanusGraph releases page. For example JanusGraph 0.2.2 is compatible with Tinkerpop 3.2.9.
Next you need to start a JanusGraph server using ConfiguredGraphFactory. You just have to use the file
conf/gremlin-server/gremlin-server-configuration.yaml
from the ditribution.This file differs from the traditional
conf/gremlin-server/gremlin-server.yaml
in those few linesThen we need to load the graph
MYGRAPH
during the initialization script of the server. Please create an init scriptscripts/init.groovy
. Here you can load as many different graphs as you want.Make sure this script is executed when gremlin server starts in
conf/gremlin-server/gremlin-server-configuration.yaml
Finally in your Python project, install the gremlin-python package that matches the Tinkerpop version of your version of JanusGraph. In case of JanusGraph 0.2.2, this is version 3.2.9.
Start a Python shell and start coding: