In Django 1.1 I was able to produce the SQL used by a QuerySet
with this notation:
QuerySet.query.as_sql()
In Django 1.2, this raises as AttributeError
.
Anyone know the Django 1.2 equivalent of that method?
Thanks
In Django 1.1 I was able to produce the SQL used by a QuerySet
with this notation:
QuerySet.query.as_sql()
In Django 1.2, this raises as AttributeError
.
Anyone know the Django 1.2 equivalent of that method?
Thanks
In Django 1.1, QuerySet.query
returned a BaseQuery
object, not it returns a Query
objects. The query object has a __str__
method defined that returns the SQL.
as answered in http://stackoverflow.com/questions/3474505/in-django-1-2-1-how-can-i-get-something-like-the-old-as-sql
it's just:
print QuerySet.query