Search code examples
pythonneo4jneo4jrestclient

Change neo4j database location within python


I understand that I can set the database location by changing the following line in /conf/neo4j-server.properties

org.neo4j.server.database.location=data/graph.db

Is it possible to do this within a python instance? For example, I'm using neo4jrestclient

neo4j_login = {
    "username" : "neo4j",
    "password" : "supersecret",
    "url" : "http://localhost:7474"
}

from neo4jrestclient.client import GraphDatabase
gdb = GraphDatabase(**neo4j_login)

Can I somehow set the location of the database I'd like to open to a local directory?


Solution

  • If you're using the REST client, then you're not talking to a local directory, so no - in any case you'll be using a local endpoint. Via that REST client, I believe your only option is to point the server to a directory and then point the REST client to the same place you would have anyway.

    Now, if this were java, you could use the neo4j-shell or other tools to open up any directory on your disk as a neo4j database; I don't believe that's an option with present python implementations but if I'm wrong about that someone else please jump in and indicate so.