Skip to content

Commit 82bc76e

Browse files
authored
Fixed Issue #552 - Parameterized Query Support in NDB (#553)
Fixed Issue #552 by adding proper passing of the parameters through into the query call when using Neptune database Co-authored-by: Dave Bechberger <[email protected]>
1 parent bd2ef17 commit 82bc76e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

libs/aws/langchain_aws/graphs/neptune_graph.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,14 @@ def __init__(
458458
def query(self, query: str, params: dict = {}) -> Dict[str, Any]:
459459
"""Query Neptune database."""
460460
try:
461-
return self.client.execute_open_cypher_query(openCypherQuery=query)[
462-
"results"
463-
]
461+
if params:
462+
return self.client.execute_open_cypher_query(openCypherQuery=query, parameters = json.dumps(params))[
463+
"results"
464+
]
465+
else:
466+
return self.client.execute_open_cypher_query(openCypherQuery=query)[
467+
"results"
468+
]
464469
except Exception as e:
465470
raise NeptuneQueryException(
466471
{

0 commit comments

Comments
 (0)