10

From what I've read Neo4j implements apache tinkerpop which leads me to think I can use gremlin python and rather than connect to a gremlin server I can point the python code at a neo4j server and treat it like a gremlin server.

However I can't find any information online which shows how to do this so I'm thinking maybe I've misunderstood something.

  • a) Can I use gremlin python directly with a neo4j db instance?
  • b) If yes to (a) then how?

Thanks

Alex

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
Alex Ward
  • 461
  • 4
  • 16

1 Answers1

5

You can not connect gremlin-python to Neo4j Server. gremlin-python contains drivers that connect to Gremlin Server so you must have that installed for gremlin-python to work. Given that you need Gremlin Server you must choose one of the following options all of which are just Gremlin Server configurations:

  1. Configure Neo4j in embedded mode within Gremlin Server. An example of this is here where that file points to a Neo4j configuration file. Note that these files are packaged in the Gremlin Server distribution as samples so you can run them directly quite easily.
  2. Modify the aforementioned Neo4j configuration file to run Neo4j in HA mode effectively turning Gremlin Server into a node in the Neo4j cluster.
  3. Configure a neo4j-gremlin-bolt instance which will use the Neo4j Bolt protocol to connect to the running Neo4j Server. While I"m not completely familiar with this implementation, I can see that you would change the gremlin.graph to com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph and that you would discern Bolt configuration options from this class (which instantiates that graph instance).

Once you've chosen one of those configuration options you can then use gremlin-python to work with Neo4j.

stephen mallette
  • 45,298
  • 5
  • 67
  • 135
  • how can I work with Neo4J in Gremlin and Python then? I've tried to find but there aren't any guides on this topic. After starting an instance running Neo4J, how can I run Gremlin queries on it in Python? – cryanbhu Feb 07 '19 at 06:53
  • 1
    i've tried to improve the answer a bit. hope that clarifies things. – stephen mallette Feb 07 '19 at 11:57
  • @stephenmallette Can you provide detailed information on point 2 and 3 suggested by you if possible? – anurag2090 Feb 19 '19 at 13:05
  • there's not much more detail. i mean, in point 1 i point you to a configuration file for embedded mode. you modify that configuration file as needed for points 2 and 3. for point 2, the configuration example in the link i provided. for point 3 you'd have to consult that project's documentation as i'm not familiar with its exact configuration options but I updated my answer with some extra tips to get you going in the right direction. – stephen mallette Feb 19 '19 at 13:23
  • I have downvoted this answer since i did not find any concrete implementation out there see e.g. https://github.com/SteelBridgeLabs/neo4j-gremlin-bolt/issues/71 or https://community.neo4j.com/t/neo4j-gremlin-integration/8144 and yes personally i think *a lot more detail* is needed to get this working – Wolfgang Fahl Oct 05 '19 at 06:36