0
votes

I am trying to load the node from csv in Neo4j, however, every time I try to do this I get such an error:

Neo.ClientError.Statement.ExternalResourceFailed: Couldn't load the external resource at: file:/var/lib/neo4j/import/events.csv

My event.csv file is in /var/lib/neo4j/import directory with 777 permissions. The query I try to run looks like this:

USING PERIODIC COMMIT 500 LOAD CSV WITH HEADERS FROM "file:///events.csv"  AS line
CREATE (e:Event { event_id: toInteger(line.event_id), 
created: line.created,
description: line.description })

I set up Neo4j using the latest version of docker image. What might be wrong with file permissions or file location?

1
Did you bind-mount the file into your container?Yuankun
@Yuankun no, I didn'tCassie
Then you should, see my answer.Yuankun

1 Answers

2
votes

Docker container cannot get access to files outside on the host machine, unless you mount those files to the container.

Solution is to bind-mount the directory to your container when calling the docker run command:

docker run -v /var/lib/neo4j/import:/var/lib/neo4j/import ... <IMAGE> <CMD>