For a recent project I just needed a list of countries for a user to be selected.

Fills the need perfectly; now how to get that into Neo?

When googling around it probably takes less than  a few seconds to find a reference to the LOAD CSV command.

Another half a minute later and you will have found that you can very easily import it as such:

LOAD CSV WITH HEADERS FROM "file:///countries.csv" AS line 
CREATE (c:Country {code:line.alpha-2, name:}) return c

Not sure on how you feel doing that but replicating all those field and column names feels very tedious and to top it of error prone..

Wouldn’t it be great if Cypher could do the heavy lifting and transfer all the fieldnames to your new nodes?

Well actually you can:

LOAD CSV WITH HEADERS FROM "file:///countries.csv" as line 
CREATE (c:Country) set c=line

Thats it; all done 🙂


Oh and remember: that file:/// points to the import directory of your graph.db folder and yes; you are supposed to create it yourself 🙂