I try to execute a query in Python/Django, but eventually I end up with ProgrammingError
. My script looks like this:
#--coding: utf-8
...
import pyodbc
...
def testquery(request):
cnx = pyodbc.connect("DRIVER=FreeTDS;SERVER=192.168.0.1;PORT=1433;DATABASE=mydatabase;UID=sa;PWD=password;TDS_Version=7.0;ClientCharset=UTF8;")
cursor = cnx.cursor()
cursor.execute("SELECT * FROM sys_Атрибут")
...
As you can see, the name of a table contains non-latin characters. If I instead query another table, whose name is in Latin, then it's ok.
I also tried this:
cursor.execute("SELECT * FROM ?",tablename)
And this:
cursor.execute("SELECT * FROM %s" % tablename)
But it has no effect.