From: Ganesan R <rga...@my...> - 2003-02-14 06:31:22
|
Hi, I have an application where the table name is known only at run time. Imagine something like cursor.execute("SELECT * FROM %s WHERE id = %s", table, 25) This doesn't work. pyPgSQL appears to quote all arguments passed via pyformat which causes a syntax error. I am not sure where this is bug because the table name is not a SQL parameter. I then tried cursor.execute("SELECT * FROM %s WHERE id = %s" % table, 25) This doesn't work either because the % operator complains about "not enough arguments for format string". I finally worked around by using cursor.execute("SELECT * FROM " + table + " WHERE id = %s", 25) Is there a syntactically clear alternative? Ganesan |