Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: neo4j apoc.runMany added! #11

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tc_neo4j_lib/neo4j_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")
Loading