there is a copy_to to copy table data into file like:
cursor.copy_to(fp, 'table_name')
but I don't need to copy all table data, just a part of it. So when I do:
cursor.execute(query)
cursor.copy_to(fp, 'table_name')
it still copies the whole table. Is there a way to copy data from the query?
question from:https://stackoverflow.com/questions/65929241/psycopg2-copy-to-part-of-table