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", diff --git a/tc_neo4j_lib/neo4j_ops.py b/tc_neo4j_lib/neo4j_ops.py index 603274f..3b2ddb4 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,11 @@ 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}")