In [19]: def show_sql(query):
....: clauses = query._get_sql_clause()
....: return 'SELECT %s %s' % (', '.join(clauses[0]),
clauses[1])
....:
In [21]: show_sql(Page.objects.all())
Out[21]: 'SELECT "main_page"."id", "main_page"."title",
"main_page"."slug", "main_page"."content" FROM "main_page" ORDER BY
"main_page"."id" ASC'
On Apr 10, 7:10 pm, [EMAIL PROTECTED] wrote:
> I need to translate django db-api query code like
> modelobject.objects.all() to a raw SQL from a shell, is it possible
> without using connection.queries (which is logging all SQL - i just
> need one for a particular line of code)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---