Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-27-2021 07:13 AM
I have two csv files , one is persons.csv and the other is relationship.csv file, they have below structure:
person.csv
name, age, sex
Bob, 25, male
Jone, 36, male
Nancy, 34, female
relationship.csv
name0, name1, relationship_weight
Bob, Jone, 20
Nancy, Bob, 30
Jone, Nancy, 100
I want to load the csv files, and create relationship with the realtionship.csv file, anyone can help me? thanks in advanced
Solved! Go to Solution.
02-27-2021 10:03 PM
Try this:
LOAD CSV WITH HEADERS FROM "file:///relationship.csv" AS row
with row
MATCH (a:Name {name: row,name0})
MATCH (b:Name {name: row.name1})
MERGE (a)-[:KNOWS {weight: toInteger(row.relationship_weight)}->(b)
02-27-2021 10:03 PM
Try this:
LOAD CSV WITH HEADERS FROM "file:///relationship.csv" AS row
with row
MATCH (a:Name {name: row,name0})
MATCH (b:Name {name: row.name1})
MERGE (a)-[:KNOWS {weight: toInteger(row.relationship_weight)}->(b)
02-28-2021 01:24 AM
Thanks amyasoft a lot , it works
All the sessions of the conference are now available online