Created
January 2, 2013 15:16
What is the best escape character strategy for Python/MySQL combo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
column = str(MySQLdb.escape_string(row[1])) | |
query = "update myTable set %(column)s = %%s where ID = %%s" % dict(column = column) | |
cursor2.execute(query, [row[3], row[0]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment