при запуске такого кода:
list_id = [1,2,3,4,5,] .... cur.execute(""" DELETE FROM `mbpjs_tst_jglist_companies` WHERE id in %s """, tuple(list_id))
list_id = [1,2,3,4,5,] .... cur.execute(""" DELETE FROM `mbpjs_tst_jglist_companies` WHERE id in %s """, tuple(list_id))
>>> """ %s """ % '(1, 2, 3)' ' (1, 2, 3) ' >>>
cur.execute(""" DELETE FROM `mbpjs_tst_jglist_companies` WHERE id in %s """, (tuple(list_id), ))
JOHN_16я не знал
Здесь %s это не питоновская подстановка
list_id = [1,2,3,4,5,] .... cur.execute(""" DELETE FROM `mbpjs_tst_jglist_companies` WHERE id in (%s) """, (','.join(list_id),))
Warning Never, never, NEVER use Python string concatenation (+) or string parameters interpolation (%) to pass variables to a SQL query string. Not even at gunpoint.
list_id = [1,2,3,4,5,] .... cur.execute(""" DELETE FROM `mbpjs_tst_jglist_companies` WHERE id in (%s) """ % ','.join(list_id))
list_id = list(range(1000)) cur.execute(""" DELETE FROM `mbpjs_tst_jglist_companies` WHERE id in %s """, (tuple(list_id), ))
list_id = [1,2,3,4,5,] .... cur.execute(""" DELETE FROM `mbpjs_tst_jglist_companies` WHERE id in (%s) """ % ','.join(list_id))