cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How do I parse a data with column that needs to be splitted while using neo4j admin-import?

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.

3 REPLIES 3

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.

ameyasoft
Graph Maven
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"]

Instead of data, if we use data:STRING

it worked. Thank you

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online