Executing raw SQL against SQLite with Django results in `DatabaseError: near “?”: syntax error`
问题 For example, when I use cursor.execute() as documented: >>> from django.db import connection >>> cur = connection.cursor() >>> cur.execute("DROP TABLE %s", ["my_table"]) django.db.utils.DatabaseError: near "?": syntax error When Django's argument substitution is not used, the query works as expected: >>> cur.execute("DROP TABLE my_table") django.db.utils.DatabaseError: no such table: my_table What am I doing wrong? How can I make parameterized queries work? Notes: Suffixing the query with ;