简体   繁体   中英

unable to find the correct exception

I use py2neo to insert data from a json. Everything works perfects.

But I was unable to find in the documentation the information related to this exception.

neo4j.exceptions.ConstraintError: Node(0) already exists with label `Documents` and property `itemid` = '994263771'

I was trying with

except py2neo.database.status.ConstraintError

But this only work with py2neo 3.x

You apparently have a uniqueness constraint on the itemid property of the Documents label. Therefore, whenever neo4j detects that you are trying to create a new Documents node with the same itemid value as an existing Documents node, it is throwing an exception indicating a constraint violation.

You should use the merge method instead of create .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM