Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-20-2020 11:46 AM
Hello all,
I have a node and relationship csv. In relationship, I have a column where I need to split the column on a pipe. I tried using --array-delimiter = '|' but It doesn't split the data. My data looks like
node.csv
identifier:ID,name:LABEL
1,apple
2,ball
3,cat
rel.csv
source_ids:START_ID,target_ids:END_ID,type:TYPE,data
1,2,connection,
2,3,relation,test1|test2
3,1,connection,test1
1,3,relation,test4|test3|tet6
I used the code
neo4j-admin import --verbose --ignore-extra-columns=true --array-delimiter "|" --nodes C:/Users/Sam/Documents/node.csv --relationships C:/Users/Sam/Documents/rel.csv.
The result I get is :
{
"data": "test4|test3|tet6"
}
what I want is :
{
"data": ["test4","test3","tet6"]
}
I am using Neo4j 4.0.0 community.
04-20-2020 08:53 PM
I've never tried the array delimiter option. If you can't get it to work my other suggestion would be that after you import the data you could write a cypher command to refactor the data into correct model after it's loaded. The APOC library can help iterate the same command over and over again until all the data is found to be clean.
04-21-2020 11:20 AM
Try this:
with split("test4|test3|tet6", "|") as t1
with [t1[0], t1[1], t1[2]] as t2 return t2
Replace "test4|test3|tet6" with data per your csv.
Result: ["test4", "test3", "tet6"]
04-22-2020 10:54 AM
Instead of data, if we use data:STRING
it worked. Thank you
All the sessions of the conference are now available online