How do I fix this Neo4j APOC query that creates no

2019-08-02 07:43发布

I want the query to read the CSV file and create a node for each row in the file.

Here's the query:

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.NodeID}) yield node return count(*)

Here's the error:

Can't coerce `RootNode` to List<String>

Here's the data file:

NodeType,NodeID,SchemaName,TableName,AttributeName,DataType,PreviousNodeID
RootNode,queryprocessingtest.q01.testfieldatablec ,queryprocessingtest,q01,testfieldatablec ,varchar,
Node,queryprocessingtest.qc.testfieldatablec ,queryprocessingtest,qc,testfieldatablec ,varchar,queryprocessingtest.q01.testfieldatablec 
Node,queryprocessingtest.ttablec.testfieldatablec ,queryprocessingtest,ttablec,testfieldatablec ,varchar,queryprocessingtest.q01.testfieldatablec 

1条回答
Ridiculous、
2楼-- · 2019-08-02 08:16

The first argument of the apoc.create.node procedure must be an array.

So you need to convert the value of map.NodeType into an array:

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.NodeID}) yield node return count(*)
查看更多
登录 后发表回答