Hello! I use sqlite3 module for my sqlite database. I am trying to substitute table name in sql query.
>>> import sqlite3 >>> con = sqlite3.connect('mydb') >>> cur = con.execute("select * from table where name='Joe'") That's ok >>> cur = con.execute("select * from table where name=?", ('Joe',)) That's ok too >>> cur = con.execute("select * from ? where name=?", ('table', 'Joe')) Traceback (most recent call last): File "<string>", line 1, in <fragment> sqlite3.OperationalError: near "?": syntax error So what's wrong now? Is it impossible to substitute table names, using DB API? If so, what is a way to make table name substitutions? Are string operations like 'select * from %s where...' % tablename ok in this case? Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list