I have a bug somewhere in my query - and any help would be very appreciated. I use LOAD CSV to import data into my DB. The CSV for testing is
"User1","Group1"
"User2","Group2"
"User3","Group3"
"User1","Group1"
"User2","Group2"
Result for the import should be
I work with this query:
LOAD CSV FROM "file:....." AS csvLine
MERGE (u:User { name: csvLine[0]})
MERGE (g:Group { name: csvLine[1]})
CREATE (u)-[:IS_MEMBER_OF]->(g)
Whenever I run the import I get all as expected with one exception. The first user in the csv file is always doubled - I have always two nodes with the first user name. All other users exists exactly one time. I would be happy to learn what's wrong with this approach - any comments are appreciated.
Thanks Balael
I tried this and ended up with 3 Users, 3 Groups and the relationships connecting them exactly as you'd expect:
load csv from "https://gist.githubusercontent.com/mneedham/256b809f5622aebc311f/raw/0be2d9fac59ee453314c140f778c25b8fcad4b4c/file.csv" as csvLine
MERGE (u:User { name: csvLine[0]})
MERGE (g:Group { name: csvLine[1]})
CREATE (u)-[:IS_MEMBER_OF]->(g)
Can you show the output of doing:
MATCH (u:User) RETURN u
and:
MATCH (g:Group) RETURN g
Thanks Mark
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments