开发者

Django 1.2 Equivalent of QuerySet.query.as_sql()

开发者 https://www.devze.com 2022-12-31 06:04 出处:网络
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.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 D开发者_运维知识库jango 1.2 equivalent of that method?

Thanks


In Django 1.1, QuerySet.query returned a BaseQuery object, now it returns a Query objects. The query object has a __str__ method defined that returns the SQL.


as answered in In django 1.2.1 how can I get something like the old .as_sql?

it's just:

print QuerySet.query
0

精彩评论

暂无评论...
验证码 换一张
取 消