Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-20-2020 09:40 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.
12-30-2020 01:58 PM
I think you need to do something like:
dbms.directories.import=import
dbms.directories.import=ABSOLUTE_DIRECTORY_PATH
and run Cypher like this, using the split
function String functions - Neo4j Cypher Manual
LOAD CSV WITH HEADERS FROM "file:///node.csv" AS row
CREATE (node:Label {data: split(row.data, '|')} )
You might have to do a second pass to create the relationships, which will require something like a MATCH for the node and then separate CREATE/MERGE for the relationship.
I hope that helps.
12-30-2020 03:21 PM
Default data type is string for data. May be you can try changing this line to
source_ids:START_ID,target_ids:END_ID,type:TYPE,data:string[]
All the sessions of the conference are now available online