[英]unable to find the correct exception
I use py2neo to insert data from a json. 我使用py2neo从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 但这仅适用于py2neo 3.x
You apparently have a uniqueness constraint on the itemid
property of the Documents
label. 您显然在“
Documents
标签的itemid
属性上具有唯一性约束 。 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. 因此,每当Neo4j的检测到您正试图创建一个新的
Documents
具有相同节点itemid
值作为现有Documents
节点,它抛出一个异常,指示违反约束。
You should use the merge
method instead of create
. 您应该使用
merge
方法而不是create
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.