I'm running 2 docker containers.
- Flask app - which has file volume attached.
- Postgres database which has a database volume attached.
I'm connecting to the Postgres container using Psycopg2 from Flask app. And I have a CSV file that I want to copy to the Postgres table. This CSV file is present in the volume attached to flask app. and the postgres container has no connection to this volume.
When I create a connection using psycopg2
and create a cursor
and execute the copy
command on that table. It is trying to copy from the folder that I have in Postgres container.
I tried \copy
instead of copy
for copying the data from the client container. But I'm getting Invalid syntax error. I even tried \\copy
. That didn't work either.
Unable to process files due to exception: syntax error at or near "\" LINE 1: \copy account(username,password,email) from '/tmp/redshift11...