Error loading data - No such file or directory

658 Views Asked by At

Deployed anzograph on Docker running on Mac.

Trying to load data using using the sample movie actors file using the following insert command within the query console,

INSERT { GRAPH <actors> {
  ?MovieIRI a <Movie> ;
    <MovieTitle> ?MovieTitle .
  ?ActorIRI a <Actor> ;
    <ActorName> ?ActorName .
  ?ActorIRI <ActedIn> ?MovieIRI .
  }
}
WHERE { TABLE <file:/home/usera/movie-actors.csv>
('csv','leader',',',true,'MovieID:long,MovieTitle:char,ActorID:long,ActorName:char')
BIND(IRI(CONCAT("Movie",str(?MovieID))) as ?MovieIRI)
BIND(IRI(CONCAT("Actor",str(?ActorID))) as ?ActorIRI)
}

After executing, I receive error,

Error - /home/usera/movie-actors.csv; No such file or directory

What is odd is the file exists in the directory above.

2

There are 2 best solutions below

0
On

To be able to allow AnzoGraph to load files from the container local (overlay) filesystem, you need to get them there.

as answered earlier, you could copy the files into the container, but it may make sense to just volume mount them, if they are already accessible on the docker host.

export data_p=/some/path/on/dockerhost
export data_c_p=/some/path/in/docker/container


docker run -d -v $data_p:data_c_p -p 80:8080 -p 443:8443  -p 5600:5600 -p 5700:5700 --name=anzograph cambridgesemantics/anzograph:2.1.1-latest

AnzoGraph will see the files that you put in $data_p at $data_c_p in the container

0
On

The database is looking for the file inside the docker container where Anzograph is running and not on your local/host machine where your file is located.

You will need to actually move/copy the file to the docker container before executing the insert command.

In Docker, run the following command to access the AnzoGraph file system, the /opt/anzograph directory:

sudo docker exec -it anzograph_container_name /bin/bash


Where anzograph_container_name is the name of the AnzoGraph container whose file system you want to access. For example: 
sudo docker exec -it anzograph /bin/bash

Determine where on the file system you would like to place the load files and create a new directory if necessary. For example: mkdir /opt/anzograph/csv/


Type exit to exit the container.

Run the following Docker command to copy files from the host server to a location in the AnzoGraph container. sudo docker cp /path/filename anzograph_container_name:/path/dir


For example: 
sudo docker cp /home/usera/movie-actors.csv anzograph:/opt/anzograph/csv/


Or this command copies a directory to the container:


sudo docker cp -r /path/dirname anzograph_container_name:/path


For example: 
sudo docker cp -r /home/user/movie-actors.csv anzograph:/opt/anzograph/csv/


Modify the path in the WHERE clause in your INSERT query to reflect new location.