1
votes

My code:

cursor.execute("select * from PRODUCT where product_id in (?)", (ids,))
print(cursor.fetchall())

where ids is a tuple of integer values like (2,4) and product_id are also integer values.

The error I'm getting is:

File "c:/Users/deboparna/Desktop/college/Sem4/programming language/project/db.py", line 32, in fetchProducts cursor.execute("select * from PRODUCT where product_id in (?)", (ids,)) sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

1
Please provide the entire error message, as well as a minimal reproducible example. - AMC

1 Answers

1
votes

You need placeholders for each id.
You also should just use ids as a tuple, and not make it a tuple of a tuple.

placeholders = ",".join("?"*len(ids))
qry = "select * from product where product_id in ({})".format(placeholders)
cursor.execute(qry,ids)