In previous versions of Neo4j (2.X), LOAD CSV would take absolute path from
LOAD CSV WITH HEADERS FROM
'file:///absolute/path/GraphExample2.csv' AS line
However in 3.x, its appending it with NEO4J_HOME
to that path.
How does one address absolute path for file imports?
To import data from a CSV file into Neo4j, you can use LOAD CSV to get the data into your query. Then you write it to your database using the normal updating clauses of Cypher. A new node with the Artist label is created for each row in the CSV file.
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.
From the Open dropdown menu of your Neo4j instance, select Terminal, and navigate to <installation-version>/import.
When using LOAD CSV one can define the field delimiter used, whereby the default is the ',' character. LOAD CSV WITH HEADERS from 'file:///actors.csv' as row FIELDTERMINATOR '\u0080' RETURN row.name; the usage of '\u' as a FIELDTERMINATOR needs to be a 4 character zero padded value.
In your configuration file (see here for the documented locations), comment out the dbms.directories.import setting. That will allow neo4j to use your path, as is.
However, commenting out that setting is not secure, so do not do this on production servers.
NOTE: On my Mac, I have the desktop version of neo4j installed. The official documentation seems to have the wrong name for the config file. Mine is named .neo4j.conf
, not neo4j.conf
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With