As the whole query needs to be in a string format while execution of query so %s
should be used…
After query is executed integer value is retained.
So your line should be.
.execute("INSERT INTO table VALUES(%s,%s)", (int(id), string))
Explanation is here