Charlotte
Charlotte

Reputation: 51

import csv file on Neo4J with a Mac: which path to use for my file?

I am a new user of Neo4J. I would like to import a simple csv file into neo4J with my Mac, but it seems I am doing something wrong with the path to my file. I have tried many different ways but it is not working. the only workaround I found is to upload it on dropbox....

please see below the code I am using/

LOAD CSV WITH HEADERS FROM "file://Users/Cam/Documents/Neo4j/default.graphdb/import/node_attributes.csv" as line
RETURN count(*)

the error message is:

Cannot load from URL 'file://Users/Cam/Documents/Neo4j/default.graphdb/import/node_attributes.csv': file URL may not contain an authority section (i.e. it should be 'file:///')

I already try to add some /// in the path but it is not working.

Upvotes: 4

Views: 4052

Answers (2)

InverseFalcon
InverseFalcon

Reputation: 30417

If the CSV file is in your default.graphdb/import folder, then you don't need to provide the absolute path, just give the path relative to the import folder:

LOAD CSV WITH HEADERS FROM "file:///node_attributes.csv" as line
RETURN count(*)

Upvotes: 2

manonthemat
manonthemat

Reputation: 6251

I'd use neo4j-import from the terminal:

Example from https://neo4j.com/developer/guide-import-csv/

neo4j-import --into retail.db --id-type string \
             --nodes:Customer customers.csv --nodes products.csv  \
             --nodes orders_header.csv,orders1.csv,orders2.csv \
             --relationships:CONTAINS order_details.csv \
             --relationships:ORDERED customer_orders_header.csv,orders1.csv,orders2.csv

What is not working when you try

LOAD CSV WITH HEADERS FROM "file:///Users/Cam/Documents/Neo4j/default.graphdb/import/node_attributes.csv" as line RETURN count(*)

?

Upvotes: 0

Related Questions