Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j Importing local CSV File

Tags:

neo4j

cypher

I'm trying to import a local csv file but I have got InvalidSyntax Error.

LOAD CSV WITH HEADERS FROM file:C:/csv/user.csv

Invalid input '/' (line 1, column 35 (offset: 34)) "LOAD CSV WITH HEADERS FROM file:C:/csv/user.csv"

like image 285
user2238244 Avatar asked May 18 '16 12:05

user2238244


1 Answers

The command below will return the first 5 lines of your CSV file:

LOAD CSV WITH HEADERS FROM "file:///<PATH_TO_YOUR_CSV_FILE>" AS line WITH line RETURN line LIMIT 5;

But you'll have to follow some steps to align with Neo4J security restrictions.

1) Find the conf folder in the neo4j server folder. Open the neo4j.conf with a text editor.

2) Uncomment the line containing:

#dbms.security.allow_csv_import_from_file_urls=true

To uncomment it, just remove #. It should be like this:

dbms.security.allow_csv_import_from_file_urls=true

3) Comment this line below:

dbms.directories.import=import

To comment it, add #. It should be like this:

#dbms.directories.import=import

Further on importing from CSV in neo4j documentation here: https://neo4j.com/blog/importing-data-neo4j-via-csv/

like image 72
Victor Longo Avatar answered Sep 27 '22 20:09

Victor Longo