Kaushik Velusamy
Kaushik Velusamy

Reputation: 111

Neo4j-admin import examples

Can you give me example for a neo4j-admin import command.

After reading the man page

kaushik@machine1:/neo4j/import$ ../bin/neo4j-admin import                                                                   No input specified, nothing to import     
usage: neo4j-admin import [--mode=csv] [--database=<name>]
                      [--additional-config=<config-file-path>]
                      [--report-file=<filename>]
                      [--nodes[:Label1:Label2]=<"file1,file2,...">]
                      [--relationships[:RELATIONSHIP_TYPE]=<"file1,file2,...">]
                      [--id-type=<STRING|INTEGER|ACTUAL>]
                      [--input-encoding=<character-set>]
                      [--ignore-extra-columns[=<true|false>]]
                      [--ignore-duplicate-nodes[=<true|false>]]
                      [--ignore-missing-nodes[=<true|false>]]
usage: neo4j-admin import --mode=database [--database=<name>]
                      [--additional-config=<config-file-path>]
                      [--from=<source-directory>]

I tried

../bin/neo4j-admin import --database=social.db --id-type string --nodes[:label1]=head.csv,file1.csv.gz 

I followed the header file conventions given at end of this blog https://neo4j.com/blog/bulk-data-import-neo4j-3-0/

The errors that I got

Expected '--nodes' to have at least 1 valid item, but had 0 []

or "nodes[" unrecognized command

Upvotes: 2

Views: 6418

Answers (2)

canbax
canbax

Reputation: 3856

I think you want to pass Label info from command line. For that you should do something like

bin/neo4j-admin import --nodes=Movie=import/movies5a.csv --nodes=Movie:Sequel=import/sequels5a.csv

--nodes=Movie=import/movies5a.csv passes Movie label for each node --nodes=Movie:Sequel=import/sequels5a.csv passes Movie and Sequel label for each node

more info https://neo4j.com/docs/operations-manual/current/tutorial/import-tool/#import-tool-types-labels

Upvotes: 0

Tom Geudens
Tom Geudens

Reputation: 2666

Well, here's an example :

$ bin/neo4j-admin import \
--mode csv \
--database movies3.db \
--nodes movies3-header.csv,movies3.csv \
--nodes actors3-header.csv,actors3.csv  \
--relationships roles3-header.csv,roles3.csv

And you can find the input for that on : https://neo4j.com/docs/operations-manual/current/tutorial/import-tool/

Hope this helps, Tom

P.S. Note that neo4j-admin import has replaced neo4j-import (which is still there but is deprecated). The format of the files is the same though.

Upvotes: 5

Related Questions