Cypher large write do not roll-back on partial fail


I were previously under the impression that if a Cypher write query would fail at any part, then the whole query would be discarded. However, when using a WITH statement, then everything until that line will be committed and if something fails afterwards, then the rest after the WITH statement is still applied.

I am using a javascript driver when I realized this and I am wondering how I can ensure that if I submit a large write query that if any part of it fails, then everything before and afterwards should be discarded.


What you're describing seems to be an impossibility, there is no inherent breaking up into multiple transactional commits due to usage of the WITH clause.

There are batching procedures (like apoc.periodic.iterate()) as well as USING PERIODIC COMMIT LOAD CSV, as well as Neo4j 4.4.x's CALL {} IN TRANSACTIONS that are able to issue multiple transactional commits from a single Cypher query, but WITH doesn't play a part in this at all. Perhaps one of these is being used in the query in question? It would help to see the full query.