I have a query that inserts two values in PV_ID
column.
The query is
INSERT INTO Projects (PV_ID) VALUES ('166'),('222')
I need a python code that uses string formatting to pass those values.
Thing that I have tried already:
l = ['166', '222']
query = 'INSERT INTO Projects (PV_ID) VALUES (%s)'
conn.execute(query, l)
error message :The SQL contains 1 parameter markers, but 2 parameters were supplied',
- I have tried to unpack the list above and pass it as a tuples of values but the insertion failed.
error message :There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement,
- I tried this too Insert list into my database using Python but failed.
error message :The SQL contains 1 parameter markers, but 2 parameters were supplied',
Any help is appreciated.