It depends, thats better if you want to actively see what queries are
being run, this is better if you want to see what SQL a specific query
executes.

On Mar 27, 3:24 pm, shabda <[EMAIL PROTECTED]> wrote:
> wouldn't getting the queries from connection.queries be abetter
> approach?
>
> On Mar 28, 1:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> >http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw...
>
> > or
>
> > you can make a function like this:
>
> > 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 Mar 27, 3:01 pm, qwerty <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I want so see the SQL that the Django ORM is executing behind the
> > > scenes. I know that SQLObject has this but I wanted to see if there is
> > > some similar functionality in Django. Is it?
>
> > > Thanks,
> > > Angel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to