dimanche 31 juillet 2016

how to avoid simple quote in MySQLdb python

How to avoid simple quotes when I pass two variables into the query

import sys

first_arg = sys.argv[1]
second_arg = sys.argv[2]



with con:
        def alter (var1=first_arg, var2=second_arg):
                cur = con.cursor()
                cur.execute("alter table joinit ALTER s SET DEFAULT 'TEST', ALGORITHM = %s, LOCK = %s", (var1,var2))

Aucun commentaire:

Enregistrer un commentaire