liveBook · Manning

In transactions clause

As explained in Graph Algorithms for Data Science

The IN TRANSACTIONS clause is a Cypher clause that executes a query in batches of separate transactions.

The IN TRANSACTIONS clause runs a Cypher subquery in batches of separate transactions. It is useful when importing large CSV files because smaller transactions reduce the risk of running out of memory. section 3.2.5

A typical batched import follows these steps:

  • Define CALL {} as a Cypher subquery and import enclosing variables with WITH. section 3.2.5
  • Append IN TRANSACTIONS so the subquery executes across batches; the default batch size is 1,000 rows. section 3.2.5

Import follower relationships

Use :auto in Neo4j Browser, then load the follower CSV, match existing User nodes, and merge each FOLLOWS relationship inside the batched subquery. A file with almost 25,000 rows is split into about 25 transactions by the default batch size. section 3.2.5

How Graph Algorithms for Data Science covers it

How deep it goes
Explains subquery structure, variable passing, defaults, and client syntax, but does not detail transaction internals.
Examples
Demonstrates importing follower relationships and tweets from CSV files with batched subqueries.
What it assumes
Assumes familiarity with Cypher imports, CSV rows, and existing graph nodes while teaching batching from the import workflow.
What you can do after
Operate/configure large CSV imports using CALL subqueries and IN TRANSACTIONS.
How it connects
Connects Cypher subqueries, LOAD CSV, MERGE, Neo4j Browser, and the Neo4j Python driver.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.