My question is somewhat the same as Python list of String to SQL IN parameter but I have a list of integers. The python code I use is:
ids = [1000032, 100004
You cannot provide the IN-list as one argument. You need to provide the exact number of place holders in the SQL IN clause, and then provide the array to the execute method:
ids = [1000032, 1000048]
sql = 'SELECT CompNo, CompName, CompType FROM Component WHERE DeptID IN (' \
+ (',?' * len(ids))[1:] + ')'
cursor.execute(sql, ids)