Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j 3.x LOAD CSV absolute file path

Tags:

neo4j

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?

like image 346
Joel Avatar asked Apr 28 '16 18:04

Joel


People also ask

How do I load a CSV file into Neo4j browser?

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.

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.

Where is import directory in Neo4j?

From the Open dropdown menu of your Neo4j instance, select Terminal, and navigate to <installation-version>/import.

How do you define as field terminator in load csv?

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.


1 Answers

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.

like image 144
cybersam Avatar answered Oct 17 '22 01:10

cybersam