From 7ece42bd01912525a3f95f84b5899485c36527a9 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Tue, 3 Sep 2024 17:34:28 +0330 Subject: [PATCH 1/3] feat: neo4j apoc.runMany added! --- tc_neo4j_lib/neo4j_ops.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tc_neo4j_lib/neo4j_ops.py b/tc_neo4j_lib/neo4j_ops.py index 603274f..cf3bb3e 100644 --- a/tc_neo4j_lib/neo4j_ops.py +++ b/tc_neo4j_lib/neo4j_ops.py @@ -102,6 +102,8 @@ def run_queries_in_batch( with session.begin_transaction() as tx: query_count = len(batch_queries) + apoc_run_queries: str = "" + for idx, query_item in enumerate(batch_queries): query = query_item.query query_parameters = query_item.parameters @@ -111,6 +113,9 @@ def run_queries_in_batch( logging.info( f"{message} {msg_title}: Batch {idx + 1}/{query_count}" ) - self._run_query(tx, query, **query_parameters) + + apoc_run_queries += f"CALL apoc.cypher.run('{query}', {query_parameters}); " + + self._run_query(tx, f"CALL apoc.cypher.runMany('{apoc_run_queries}', {{}})") except Exception as e: logging.error(f"Couldn't execute Neo4J DB transaction, exception: {e}") From e09210d42c3eddf10d35e402b513ffa4c1dc27c8 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Tue, 3 Sep 2024 18:16:48 +0330 Subject: [PATCH 2/3] fix: black linter issues! --- tc_neo4j_lib/neo4j_ops.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tc_neo4j_lib/neo4j_ops.py b/tc_neo4j_lib/neo4j_ops.py index cf3bb3e..3b2ddb4 100644 --- a/tc_neo4j_lib/neo4j_ops.py +++ b/tc_neo4j_lib/neo4j_ops.py @@ -116,6 +116,8 @@ def run_queries_in_batch( apoc_run_queries += f"CALL apoc.cypher.run('{query}', {query_parameters}); " - self._run_query(tx, f"CALL apoc.cypher.runMany('{apoc_run_queries}', {{}})") + self._run_query( + tx, f"CALL apoc.cypher.runMany('{apoc_run_queries}', {{}})" + ) except Exception as e: logging.error(f"Couldn't execute Neo4J DB transaction, exception: {e}") From 8e6c0b7243662d36fd1c638f3b6cba6a0031ddd8 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Tue, 3 Sep 2024 18:17:23 +0330 Subject: [PATCH 3/3] feat: bump lib version! --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 65bedc2..7e6e0ee 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="tc-neo4j-lib", - version="2.0.1", + version="2.0.2", author="Mohammad Amin Dadgar, TogetherCrew", maintainer="Mohammad Amin Dadgar", maintainer_email="dadgaramin96@gmail.com",