On Mon, Apr 26, 2010 at 07:53:17PM +0200, Norman Khine wrote:
> ok this worked,
> 
> cursor.execute(drop_user_tables % ",".join(user_tables))
> 
> it seems that DROP TABLE (and other DDL statements) don't technically
> take SQL parameters.


That's correct.  The point of using %s as a placeholder for an SQL
value (not to be confused with %s in string formatting with the % operator
in Python), is to prevent them from being confused with SQL *statement*
code but made into proper values (strings, integers, and so forth).

But the names of tables, fields, etc., are NOT values, they are part
of the SQL syntax and you have to build them as part of the string
itself.
-- 
Steve Willoughby    |  Using billion-dollar satellites
st...@alchemy.com   |  to hunt for Tupperware.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to