Reputation: 145
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.
Upvotes: 10
Views: 12877
Reputation: 1638
This one worked at my end in windows
LOAD CSV FROM 'File:///order-details.csv' AS row RETURN count(row);
Upvotes: 0
Reputation: 1
I was getting this problem as well so what I did was to copy the folder in which the .csv file was present to the following location:
C:\Users\Username\AppData\Roaming\Neo4j Desktop\Application\neo4jDatabases\database-27badd10-8989-482d-871b-cad746091f07\installation-3.3.3\import\
it seems when neo4j is installed and we try to import data from files by giving "file:///c://........" then neo4j starts looking for that file in the location C:\Users\Username\AppData\Roaming\Neo4j Desktop\Application\neo4jDatabases\database-27badd10-8989-482d-871b-cad746091f07\installation-3.3.3\import\
i.e the import folder. So we have to copy all the files needed to be imported by this this type of statement in that import folder.
Upvotes: 0
Reputation: 1
Create a folder import under default.graphdb
and place your csv files there. Later, you can use file:///fileName.csv in your LOAD CSV query
Upvotes: 0
Reputation: 468
Use the path 'file:///F:/Neo4JData/Destination.csv' and add the Destination.csv file to the neo4jDB\import directory.If the import directory is not there create a new directory named as import and add the file.
Upvotes: 0
Reputation: 11
Putting the .csv into the $NEO4JHOME/default.graphdb/import directory worked. You may have to create the folder, or maybe uncommenting the dbms.directories.import=import line in conf might do it. I dunno, did it the hard way :)
However, I found that I still had to include the drive specifier, i.e., file:///c:\csv2import.csv even if it wasn't in the root but in the import directorry
Upvotes: 0
Reputation: 310
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.
Upvotes: 2
Reputation: 79
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});
Upvotes: 7
Reputation: 51
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
Upvotes: 5
Reputation: 878
Are you using 2.3.0 Community Edition?
try:
USING PERIODIC COMMIT 10000 LOAD CSV FROM 'file:///F:\\Neo4JData\\Destination.csv
Upvotes: 9
Reputation: 20185
The file path seems wrong, can you try with :
"file:F:///Neo4JData/Destination.csv"
Upvotes: 1