I've looked into this feature and it's harder than I thought. I only
examined the "COPY FROM" part, because the "COPY TO" is not much
different (from a high-level viewpoint). And I did not examine
everything in detail, but just enough to see how it basically works.
COPY FROM/TO using a file path should work fine, but the file would be
read or written by the database server and not the client. Would be
nicer if you can open a file in Python and feed it to the database
like you can do in "normal" Psycopg2.
What Psycopg2 does in case of COPY FROM is using STDIN and not a file
path. And uses `PQputCopyData` from libpq to write the data from the
file to the connection. This functionality is not exposed to Python
(couldn't find it). That's problem one. The Second problem is you
can't read or write files in a non-blocking way in Tornado.