I am having trouble importing a CSV with an array into neo4j 2.2.0 using Cypher
Having read about the "CSV header format" (http://neo4j.com/docs/stable/import-tool-header-format.html), I created this file:
name:ID,species,images:string[]
1,Tortula muralis,1.jpg;2.jpg;3.jpg
2,Anthoceros agrestis,6.jpg
3,Marchantia polymorpha,4.jpg;5.jpg
I tried:
LOAD CSV WITH HEADERS FROM 'file:/home/hannes/temp/bryo' AS line
CREATE (a:Bryophyte)
SET a=line
The import itself works. I get three new nodes. If I then print all Broyphyte nodes, the property "image" seems to be one string, not an array.
Not enough reputation to post a pic, sorry...
You are mixing up two things.
For the import tool that you refer to, the import works with
bin/neo4j-import --into test.db --nodes bryo.csv
Whereas for LOAD CSV you'd use a normal header and do the conversions in Cypher:
id,species,images
1,Tortula muralis,1.jpg;2.jpg;3.jpg
2,Anthoceros agrestis,6.jpg
3,Marchantia polymorpha,4.jpg;5.jpg
I tried:
LOAD CSV WITH HEADERS FROM 'file:/home/hannes/temp/bryo' AS line
CREATE (a:Bryophyte {id:line.id, name:line.name,
images:split(line.images,",")})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With