Reputation: 9419
I have a dockerized Postgres container that I can manipulate from the shell using psql. I would like to fill the cities
table from a CSV file:
\copy cities(location, latitude, longitude) FROM 'postgis.csv' DELIMITERS ',' CSV HEADER;
However, this command returns "postgis.csv: No such file or directory". How can I do the above in Docker and PostgreSQL? I've tried editing my docker compose file by adding
volumes:
- ./src/db/pgdata:/var/lib/postgresql/data
And now I have the database data folder locally, but not sure where I should put the CSV file. Sorry for the noob question.
Upvotes: 1
Views: 198
Reputation: 11357
does your local ./src/db/pgdata
folder contains this csv file?
if so, what about
copy cities(location, latitude, longitude) FROM '/var/lib/postgresql/data/postgis.csv' DELIMITERS ',' CSV HEADER;
Upvotes: 1