I'm trying to perform a raw SQL query, like so
test = Poll.objects.raw('SELECT * FROM %s', ['polls_poll'])
and it results in an error:
ProgrammingError at ...
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax...
Debug Toolbar shows that Django performs the following SQL query:
SELECT * FROM 'polls_poll'
If I execute this query directly in the MySQL shell, it won't work either, unless I replace single quotes (') with backticks (`).
How do I make Django use backticks? Or what am I doing wrong?
Environment: Django 1.6, MySQL 5.6.14, OS X 10.9.