Connecting 1 specific database out multiple database with python

hii Everyone,
we have created a graph and there are three database running in it ,and if i am trying to connect it with python using py2neo then it connecting to default database, so if we want to select 1 out of 3 database ,is there anyway using py2neo and any python to neo4j connector(neo4j driver).

Hi there,

Make sure you use the v5 version of py2neo; multi database support as found in Neo4J 4 is not supported in v4 of py2neo. In v5 it is supported via the name= parameter in the Graph object.

https://py2neo.org/v5/database.html#the-graph

class py2neo.database.Graph(uri, name=None, **settings)[source]
The Graph class represents the graph data storage space within a Neo4j graph database. Connection details are provided using URIs and/or individual settings.

The name argument allows selection of a graph database by name. When working with Neo4j 4.0 and above, this can be any name defined in the system catalogue, a full list of which can be obtained through the Cypher SHOW DATABASES command. Passing None here will select the default database, as defined on the server. For earlier versions of Neo4j, the name must be set to None.
1 Like

Thanks @paulj , it worked fine.
is there any time lag in executing the query every time we call it in python?

There is always some overhead of course but in my daily usage I never had the urge to bypass the Python driver in favour of a more native one.