mirror of
https://github.com/hwchase17/langchain
synced 2024-11-13 19:10:52 +00:00
community: Fix database connections for neo4j (#27190)
Fixes https://github.com/langchain-ai/langchain/issues/27185 Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
parent
cedf4d9462
commit
481bd25d29
@ -430,7 +430,7 @@ class Neo4jGraph(GraphStore):
|
|||||||
try:
|
try:
|
||||||
data, _, _ = self._driver.execute_query(
|
data, _, _ = self._driver.execute_query(
|
||||||
Query(text=query, timeout=self.timeout),
|
Query(text=query, timeout=self.timeout),
|
||||||
database=self._database,
|
database_=self._database,
|
||||||
parameters_=params,
|
parameters_=params,
|
||||||
)
|
)
|
||||||
json_data = [r.data() for r in data]
|
json_data = [r.data() for r in data]
|
||||||
@ -457,7 +457,7 @@ class Neo4jGraph(GraphStore):
|
|||||||
):
|
):
|
||||||
raise
|
raise
|
||||||
# fallback to allow implicit transactions
|
# 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)
|
data = session.run(Query(text=query, timeout=self.timeout), params)
|
||||||
json_data = [r.data() for r in data]
|
json_data = [r.data() for r in data]
|
||||||
if self.sanitize:
|
if self.sanitize:
|
||||||
|
@ -623,7 +623,7 @@ class Neo4jVector(VectorStore):
|
|||||||
params = params or {}
|
params = params or {}
|
||||||
try:
|
try:
|
||||||
data, _, _ = self._driver.execute_query(
|
data, _, _ = self._driver.execute_query(
|
||||||
query, database=self._database, parameters_=params
|
query, database_=self._database, parameters_=params
|
||||||
)
|
)
|
||||||
return [r.data() for r in data]
|
return [r.data() for r in data]
|
||||||
except Neo4jError as e:
|
except Neo4jError as e:
|
||||||
@ -646,7 +646,7 @@ class Neo4jVector(VectorStore):
|
|||||||
):
|
):
|
||||||
raise
|
raise
|
||||||
# Fallback to allow implicit transactions
|
# 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)
|
data = session.run(Query(text=query), params)
|
||||||
return [r.data() for r in data]
|
return [r.data() for r in data]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user