You can have a look at the example at https://dzone.com/articles/how-neo4j-data-import-minimal,
$ docker exec -i my-neo4j bin/neo4j-import --into /data/databases/person.db \
--nodes:Person /data/people.csv \
--relationships:KNOWS /data/friendships.csv
This will populate the person.db
. To populate the default graph.db
,
$ docker exec -i my-neo4j bin/neo4j-shell < ./local/path/to/setup.cql
where the setup.cql
looks like
LOAD CSV WITH HEADERS FROM 'file:///data/people.csv' AS line
FIELDTERMINATOR ','
MERGE (p:Person {person_id:line.personId, name:line.name});
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///data/friendships.csv" AS line
FIELDTERMINATOR ','
MATCH (p1:Person),(p2:Person)
WHERE p1.person_id = line.personId1 AND p2.person_id= line.personId2
CREATE UNIQUE (p1)-[r:KNOWS]->(p2);
The 2 CSV files, people
& friendships
, have headers personId,name
and personId1,personId2
respectively.