Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4J Load CSV -> URI is not hierarchical

Tags:

neo4j

I try to import CSV in a Neo4j Database and I have a problem.

On my desktop computer (windows 7, java 1.8.0_40-b25), the LOAD CSV works great. But on the server (windows 2012 R2, java 1.8.0_65-b17), i have this error message "URI is not hierarchical".

I try to put the data on C:, F: ... no change.

Here's the code :

USING PERIODIC COMMIT 100
LOAD CSV WITH HEADERS FROM 
"file:F:/Neo4JData/Destination.csv"
AS line
MERGE (d:Destination {`Code`: line.`Code`});

Thanks for your help.

like image 222
Fabien T Avatar asked Nov 02 '15 15:11

Fabien T


People also ask

How do I import a CSV file into Neo4j sandbox?

In Neo4j Desktop you can open the folder in your file-manager (explorer, finder, etc) via the UI by clicking on the "Open (Folder)" dropdown or menu. Then place the files there and access them directly from Neo4j. The CSV import developer guide walks through loading local CSV files to Neo4j Desktop.


3 Answers

I had the same problem. I solved it by putting /// instead of F:/ or F:///.

So if your source is

F:/FolderOne/FolderTwo/file.csv

It becomes

///FolderOne/FolderTwo/file.csv

Remember that in order to add the file you must put file: in front of the source. So finally

file:///FolderOne/FolderTwo/file.csv
like image 130
user5882687 Avatar answered Nov 12 '22 03:11

user5882687


Create an import folder in the default path of the DB and place the file there that helped me.

For example: C:\Users\XXXXY\Documents\Neo4j\default.graphdb\import and put the csv there. In the query use USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///customers.csv" AS row CREATE (:Customer {companyName: row.CompanyName, customerID: row.CustomerID, fax: row.Fax, phone: row.Phone});

like image 26
poonam Sampat Avatar answered Nov 12 '22 03:11

poonam Sampat


Are you using 2.3.0 Community Edition?

try:

USING PERIODIC COMMIT 10000 LOAD CSV FROM 'file:///F:\\Neo4JData\\Destination.csv

like image 9
Dave Fauth Avatar answered Nov 12 '22 02:11

Dave Fauth