Search code examples
pythonjanusgraph

JanusGraph in memory for testing


How can I create in memory graph for testing purposes in python, without needing to specifically configure gremlin server - similarly to here

graph = JanusGraphFactory.build().set('storage.backend', 'inmemory').open()

I'm using gremlin-python but there is no way of building the graph, rather connecting to one.

I may of course start and configure gremlin server with in-memory backend, then connect to it. But it seems redundant given I want to use in memory for testing purposes


Solution

  • JanusGraph is a graph database written in Java. There is no native Python implementation of JanusGraph, so you need to configure the Gremlin Server with a configuration that uses the inmemory storage backend.

    gremlin.graph=org.janusgraph.core.JanusGraphFactory
    storage.backend=inmemory
    

    Check out this gist for more details on the full configuration.