I have the following code
pg_con = conns.con_to_pg()
cur = pg_con.cursor()
with open('up_md.csv', 'r') as f:
next(f) # Skip the header row.
tbl = 'bidba.upmeta'
cur.copy_from(f, tbl, 'csv', sep=',')
pg_con.commit()
The schema and table bidba.upmeta exist in my postgres db.
No matter what I do, I get the message: relation "bidba.upmeta" does not exist error.
I tried writing it with single quotes, double quotes, without quotes.
Nothing helps. What am I missing? Is there an issue with the copy_from method?
This is a known issue and will be fixed in the next version of PyGreSQL.
As a workaround, you can pass
tbl = 'upmeta'. This should work if yourbidbaschema is in the search path. Otherwise, you can put it into the search path for the current session withSET search_path TO bidba, publicbefore callingcopy_from.