splunk
splunk

Reputation: 6791

import csv file content into Neo4j database

I'm trying to import a csv file into Neo4J. I'm following this guide and I've already imported a file containing thousands of nodes (users), now I'm trying to import relationships between these nodes but I keep getting this error:

Input error: 'TYPE  '
Caused by:'TYPE '
java.lang.IllegalArgumentException: 'TYPE   '
    at org.neo4j.csv.reader.Extractors.valueOf(Extractors.java:152)
    at org.neo4j.unsafe.impl.batchimport.input.csv.DataFactories$DefaultRelationshipFileHeaderParser.entry(DataFactories.java:361)

The csv file I'm trying to import looks like this:

ID,:START_ID,:END_ID,:TYPE  
1,82513,82718,FRIEND_OF 
2,48635,21154,FRIEND_OF     
3,92784,96648,FRIEND_OF     
4,55215,86714,FRIEND_OF 
.......

And in order to import it I use the following command:

neo4j-import --into ./ --nodes my_users.csv --relationships my_rels.csv

which as I said before correctly imports all the nodes.

Upvotes: 0

Views: 238

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

It seems you have trailing spaces or tabs in your file? Please remove them.

If it is all the same rel-type you can also provide it

on the command line with --relationships:FRIEND_OF.

Upvotes: 0

Related Questions