Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-30-2020 03:27 PM
Say I have two Neo4j databases in a project and I need to switch back and forth between them. Currently, on the desktop application, I open and close the databases manually and re-run:
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))
Is there a way for me to circumvent having to manually open & close?
12-21-2020 09:39 AM
I have tried the following with a TEST_DB that I created in Neo4j desktop:
uri = "neo4j://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))
with driver.session(database="TEST_DB") as session:
cypher = '''
MATCH (n) -[r:CITES]-> (m)
RETURN n, r, m
'''
output = session.run(cypher).data()
print(output)
As well as:
uri = "neo4j://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))
session = driver.session(database="TEST_DB")
cypher = '''
MATCH (n) -[r:CITES]-> (m)
RETURN n, r, m
'''
result = session.run(cypher).data()
print(result)
session.close()
driver.close()
Both return an error:
ClientError: {code: Neo.ClientError.Database.DatabaseNotFound} {message: Unable to get a routing table for database 'TEST_DB' because this database does not exist}
12-21-2020 01:17 PM
My guess is you need to use https:/
/ instead of neo4j://
but I could wrong.... (I'm still new at this too.)
01-12-2021 02:20 AM
What you see in your Neo4j Desktop with 3 dots, a start and stop big blue buttons is not a database, it's a DBMS, database(s) management system.
I would suggest you updating your Neo4j desktop app and then create a local DBMS version 4.2.2 and then read about database administration and the USE clause.
All the sessions of the conference are now available online