Skip to content

Commit

Permalink
community: Fix database connections for neo4j (#27190)
Browse files Browse the repository at this point in the history
Fixes #27185

Co-authored-by: Erick Friis <[email protected]>
  • Loading branch information
tomasonjo and efriis authored Oct 8, 2024
1 parent cedf4d9 commit 481bd25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libs/community/langchain_community/graphs/neo4j_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def query(
try:
data, _, _ = self._driver.execute_query(
Query(text=query, timeout=self.timeout),
database=self._database,
database_=self._database,
parameters_=params,
)
json_data = [r.data() for r in data]
Expand All @@ -457,7 +457,7 @@ def query(
):
raise
# fallback to allow implicit transactions
with self._driver.session() as session:
with self._driver.session(database=self._database) as session:
data = session.run(Query(text=query, timeout=self.timeout), params)
json_data = [r.data() for r in data]
if self.sanitize:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def query(
params = params or {}
try:
data, _, _ = self._driver.execute_query(
query, database=self._database, parameters_=params
query, database_=self._database, parameters_=params
)
return [r.data() for r in data]
except Neo4jError as e:
Expand All @@ -646,7 +646,7 @@ def query(
):
raise
# Fallback to allow implicit transactions
with self._driver.session() as session:
with self._driver.session(database=self._database) as session:
data = session.run(Query(text=query), params)
return [r.data() for r in data]

Expand Down

0 comments on commit 481bd25

Please sign in to comment.