postgres delete query for batch using python

  postgresql, python

I want to do the bulk delete in postgres using python and my where clause has multiple columns to fetch the correct record.

Ex:
For One records i ran this
delete products where company_id=’123′ and product_id=1;

I tried this for multiple records but getting this error

the query contains more than one ‘%s’ placeholder

query = delete products where company_id='%s' and product_id=%s; 
values =[(1,2),(3,4)]
psycopg2.extras.execute_values(self.cursor, delete_query, values)

Source: Python Questions

LEAVE A COMMENT