Hi
I need to creates independent nodes from a csv file, csv is like below-
First, Last, Age
john, Doe, 34
null, Sam,36
My code is like this;
load csv with headers from "file:///demo.csv" as line
with line
CASE
when not line.first is null
CREATE (s:id{name:line.last})
ELSE
CREATE (s:id{name:line.first})
return count(*)
type or paste code here
Expecting it should create independent nodes with first or last name, but I am encountering this error.
Try this:
load csv with headers from "file:///demo.csv" as line
with line
FOREACH(ignoreMe IN CASE WHEN line.first IS NOT NULL THEN [1] ELSE [] END |
MERGE (s:id{name:line.last})
)
FOREACH(ignoreMe IN CASE WHEN line.first IS NULL THEN [1] ELSE [] END |
MERGE (s:id{name:line.first})
)
Thanks it worked,
follow up question,
it took 30 minutes on my desktop to ingest a 5MB csv which had 50k records in it.
I have allocated 12 GB of heal memory.
Is there a way to run it quick or i am doing something wrong ?