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.
./src/db/pgdatafolder contains this csv file? if so, what aboutcopy cities(location, latitude, longitude) FROM '/var/lib/postgresql/data/postgis.csv' DELIMITERS ',' CSV HEADER;