I am trying to use a dict to do a SQL INSERT. The logic would basically be:
dict
INSERT
INSERT INTO table (dict.keys()) VALUES dict.values() >
You want to add parameter placeholders to the query. This might get you what you need:
qmarks = ', '.join('?' * len(myDict)) qry = "Insert Into Table (%s) Values (%s)" % (qmarks, qmarks) cursor.execute(qry, myDict.keys() + myDict.values())