title: Bulk insertion into neo4j with unique constraints
body: <p>I am trying to populate some data into a neo4j database. Due to the large amount of nodes and relationships, I am using bulk inserts as described in this guide:</p>
  <p><a href="https://towardsdatascience.com/create-a-graph-database-in-neo4j-using-python-4172d40f89c4" rel="nofollow noreferrer">create-a-graph-database-in-neo4j-using-python</a></p>
  <p>My Cypher statement looks like this:</p>
  <pre><code>UNWIND $rows AS row
  MERGE (:Term {name: row.name, accession: row.accession, definition: row.definition})
  RETURN count(*) as total
  </code></pre>
  <p>Because I'm using a unique constraint, if one node with the same accession already exists</p>
  <pre><code>CREATE CONSTRAINT accession on (n:Term) assert n.accession is unique
  </code></pre>
  <p>the merge fails with the following error:</p>
  <pre><code>{message: Node(2749) already exists with label `Term` and property `accession` = 'UO:0000000'}
  </code></pre>
  <p>Is there any way to do bulk creation of nodes unless the current node already exists, so I can only update some properties, in this case everything except the accession property.</p>
  <p>thanks a lot for the help</p>