1๐
โ
str(query)
only returns an approximative representation of the query. Are you trying to pass it to the database?
The query issued with iexact
seems correct with Django 1.2.3. The above would result in WHERE UPPER("addr2zip"."street_name"::text) = UPPER(E'Common Ground')
. Which version are you using?
๐คpiro
1๐
To get the query to be executed, use something like:
from django.db import DEFAULT_DB_ALIAS
queryset.query.get_compiler(DEFAULT_DB_ALIAS).as_sql()
๐คpkoch
- [Answered ]-Unable to configure views, urls.py SyntaxError: invalid syntax
- [Answered ]-Parsing forloop.counter in form's label in Django
- [Answered ]-Django ManyToManyField as multiset
0๐
But you just pasted it like that yourself:
where = ['ctystate.zip5 = addr2zip.zip5 AND ctystate.city_name = %s' % 'Philipsburg'],
so you got query string constructed with syntax error:
AND ctystate.city_name = Philipsburg
๐คcababunga
- [Answered ]-I can't populate table from postgres to django model
- [Answered ]-Django url pattern issue in python 2.7.6
Source:stackexchange.com