[DB-SIG] MySQLdb - syntax question
patriciap.gu at gmail.com
Mon Apr 24 20:35:33 CEST 2006
I have the following code:
UPDATE mytable SET col1 = %s, col2 = %s, col3 = %s, col4 = %s,
col5 = %s, col6 = %s WHERE name = %s
In this example, entries is a list of numbers and the last element is a name of
This works fine. But, there will be times when new columns will be added based
on a dictionary I have. I've been asked not to hard code the column names (i.e.
col1, col2, etc.). I need to know if it is possible to put placeholders instead
of column names (i.e. %s=%s -> column name = column value). If so, what is the
right syntax for that?
More information about the DB-SIG