Neo4J Load CSV -> URI is not hierarchical

12,283

Solution 1

Are you using 2.3.0 Community Edition?

try:

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

Solution 2

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});

Solution 3

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

Solution 4

As specified above once you try with

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///E:/AdventureWorks/adventureworks-neo4j/data/products.csv" as row
CREATE (:Product {productName: row.ProductName, productNumber: row.ProductNumber, productId: row.ProductID, modelName: row.ProductModelName, standardCost: row.StandardCost, listPrice: row.ListPrice});

The "URI is not hierarchical" error disappears. Then most probably you will get an error saying that it couldnt load the resource like

TransientError.Statement.ExternalResourceFailure

In order to solve the same you should find the neo4j.conf file.

Since i'm using a windows 10 machine and community edition of neo4j i could find the same in the below path.

C:\Users\{username}\AppData\Roaming\Neo4j Community Edition

Edit the conf file and comment out the line

dbms.directories.import=import

Doing the above steps enabled me to load the csv file.

Solution 5

The file path seems wrong, can you try with :

"file:F:///Neo4JData/Destination.csv"
Share:
12,283
Fabien T
Author by

Fabien T

Updated on June 09, 2022

Comments

  • Fabien T
    Fabien T about 2 years

    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.