-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
articles/2020/11/15/psycopg3-copy/ #20
Comments
HI Daniele, thank you very much for laying out the updates to psycopg3 (or just psycopg, as you say). In the example around block-level copy, IDLE complains that a colon is missing after while data := copy.read() but doing so results in an error when using the overall example. After substituting my_tablename for mytable in the portion that reads COPY mytable TO STDOUTand using the rest of your code, the following error appears for the f.write(data) section: write() argument must be str, not memoryview Is the syntax different in newer versions of psycopg? I'm using 3.1.4 |
The file should be open in binary mode, using |
You're welcome; I see the "wb" has been updated. IDLE is still asking for a colon after copy.read() before it will execute, but perhaps that's just my version of Python (3.11) |
i am getting a 'Cursor' object has no attribute 'copy_expert' error. |
The new COPY support in psycopg3 — Psycopg
Python adapter for PostgreSQL
https://www.psycopg.org/articles/2020/11/15/psycopg3-copy/
The text was updated successfully, but these errors were encountered: