我正在针对 .CSV 文件运行 apoc.create.node。即使一个或多个节点由于重复键而失败,我也需要创建可以创建的节点。
我运行这个:
CALL apoc.load.csv('FILE:///C:/Temp/Test/Test/Neo4jTest/import/Neo4j_AttributeProvenance.csv',{sep:","}) YIELD map CALL apoc.create.node([map.NodeType], {Key:map.Key, AttributeName:map.AttributeName, TableName:map.TableName, SchemaName:map.SchemaName, DataType:map.DataType, PreviousKey:map.PreviousKey}) yield node return count(*)
我明白了
Neo4jUtils.ExecActionQuery().execute(): Failed to invoke procedure `apoc.create.node`: Caused by: org.neo4j.graphdb.ConstraintViolationException: Node(357) already exists with label `SubNode` and property `Key` = 'queryprocessingtest.ttablea.testDateTime'
.CSV 文件如下所示
NodeType,Key,SchemaName,TableName,AttributeName,DataType,PreviousKey
RootNode,queryprocessingtest.q01.testDateTimeX,queryprocessingtest,q01,testDateTime,datetime,
SubNode,queryprocessingtest.ttablea.testDateTime,queryprocessingtest,ttablea,testDateTime,datetime,queryprocessingtest.q01.testDateTime