cur.execute('INSERT INTO "{}" VALUES(?, ?)'.format(group.replace('"', '""')), (food, 1))
cur.execute('SELECT COUNT(Name) FROM "{}" WHERE Name=?'.format(group.replace('"', '""')), (food,))
cur.execute('UPDATE "{}" SET Times=? WHERE Name=?'.format(group.replace('"', '""')), (times_before + 1, food))
In [156]: sql Out[156]: "update foo set is_processed=1 where bar='don't look now'"
there shoudnt be a comma on the line before the WHERE clause ;)