+1 vote
in Databases by (60.0k points)

I am trying to load a large number of records from a TSV file to the Neo4j database using the following Cypher query on the Neo4j browser (Neo4j 4.4.15).

USING PERIODIC COMMIT 500

LOAD CSV WITH HEADERS FROM "file:///edges.tsv" AS row FIELDTERMINATOR '\t'

MATCH (c:Compound {node_id: trim(row.subject_id)}), (p:Protein {node_id: trim(row.object_id)})

CREATE (c)-[:RELATED_TO {relationship: row.relationship, evidence_class: row.evidence_class}]-> (p)

But it gives the following error: Executing queries that use periodic commit in an open transaction is not possible.

How to fix this error?

1 Answer

+3 votes
by (71.8k points)
selected by
 
Best answer

Prefixing "USING PERIODIC COMMIT" with ":auto" will solve the problem. Your query should look like the following:

:auto USING PERIODIC COMMIT 500

LOAD CSV WITH HEADERS FROM "file:///edges.tsv" AS row FIELDTERMINATOR '\t'

MATCH (c:Compound {node_id: trim(row.subject_id)}), (p:Protein {node_id: trim(row.object_id)})

CREATE (c)-[:RELATED_TO {relationship: row.relationship, evidence_class: row.evidence_class}]-> (p)

Related questions


...