cypher-shell icon indicating copy to clipboard operation
cypher-shell copied to clipboard

Possibility to provide CSV file in cypher-shell command

Open sdaschner opened this issue 3 years ago • 2 comments

As far as I understand, there is no easy way to take a running Neo4J instance on which I have no direct file system access and provide a CSV file for a LOAD CSV command.

Example situation

  • Neo4J running locally as Docker container, e.g. docker run --rm --name graph-db -p 7474:7474 -p 7687:7687 --env NEO4J_AUTH=neo4j/test neo4j:4.0.4
  • Cypher script that aims to convert data from a local CSV file into queries, e.g. LOAD CSV WITH HEADERS FROM 'file:///data.csv' AS row
  • A data.csv file, in the local working directory

It would be very helpful if there was a way to provide the file directly via the cypher-shell command. Now, IIUC, I have to either mount the file into my Docker container, or upload it somewhere, e.g. on GitHub and access it via HTTP.

sdaschner avatar Jul 08 '21 14:07 sdaschner

Update to this: AFAIK there's no easy possibility to upload the data here into a cloud instance, such as Aura, right?

First, I get the error that configuration property 'dbms.security.allow_csv_import_from_file_urls' is false in my Aura Free instance, and secondly I didn't find anything where to upload my CSV file to.

So, having such a way, or a functionality where cypher-shell unwraps a local CSV into Cypher commands that are sent to the db, would help a lot.

sdaschner avatar Aug 16 '21 06:08 sdaschner

Ok, another update 🙂

Using a web-hosted URL such as https://raw.githubusercontent.com/sdaschner/... works, which is not as flexible as using something from the local file system but at least gives some way that worked for me...

Maybe it would be helpful to document that somewhere, for users who are struggling with this.

sdaschner avatar Aug 16 '21 06:08 sdaschner