I have the following code:  

UPDATE mytable SET col1 = %s, col2 = %s, col3 = %s, col4 = %s,
    col5 = %s, col6 = %s   WHERE name = %s
    """, (tuple(entries)))
In this example, entries is a list of numbers and the last element is a name of
a target.

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?

Thanks,
Patty

_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to