Skip to content

Commit 88baae9

Browse files
authored
Fix/cypher syntax warning (#170)
* Remove Cypher syntax warning log * Better solution, only disable for the KGWriter run method * No comment
1 parent caffe2c commit 88baae9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/neo4j_graphrag/experimental/components/kg_writer.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ async def run(self, graph: Neo4jGraph) -> KGWriterModel:
193193
Args:
194194
graph (Neo4jGraph): The knowledge graph to upsert into the database.
195195
"""
196+
# we disable the notification logger to get rid of the deprecation
197+
# warning about Cypher subqueries. Once the queries are updated
198+
# for Neo4j 5.23, we can remove this line and the 'finally' block
199+
notification_logger = logging.getLogger("neo4j.notifications")
200+
notification_level = notification_logger.level
201+
notification_logger.setLevel(logging.ERROR)
196202
try:
197203
if inspect.iscoroutinefunction(self.driver.execute_query):
198204
await self._async_db_setup()
@@ -227,3 +233,5 @@ async def run(self, graph: Neo4jGraph) -> KGWriterModel:
227233
except neo4j.exceptions.ClientError as e:
228234
logger.exception(e)
229235
return KGWriterModel(status="FAILURE", metadata={"error": str(e)})
236+
finally:
237+
notification_logger.setLevel(notification_level)

0 commit comments

Comments
 (0)