Skip to content

Commit 62a70e1

Browse files
committed
database argument added for neo4j driver
1 parent 9a58fdc commit 62a70e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

foxylib/tools/database/neo4j/neo4j_tool.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ def env2username(cls, ):
1717
def env2password(cls, ):
1818
return os.environ.get("NEO4J_PASSWORD")
1919

20+
@classmethod
21+
def env2database(cls, ):
22+
return os.environ.get("NEO4J_DATABASE")
23+
2024
@classmethod
2125
@lru_cache(maxsize=2)
2226
def env2driver(cls, ):
2327
host = cls.env2host()
2428
username = cls.env2username()
2529
password = cls.env2password()
30+
database = cls.env2database()
2631

27-
return GraphDatabase.driver(host, auth=(username, password), encrypted=False)
32+
return GraphDatabase.driver(host, auth=(username, password), encrypted=False, database=database)
2833

2934
@classmethod
3035
def execute_query(cls, driver, query, **kargs):

0 commit comments

Comments
 (0)