Skip to content

Instantly share code, notes, and snippets.

@kevingo
Created January 2, 2013 15:16

Revisions

  1. kevingo created this gist Jan 2, 2013.
    4 changes: 4 additions & 0 deletions python-insert-db.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    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]])