Re: Getting tuple of (sql, params) from the ORM.

25 views
Skip to first unread message

Jeremy Dunck

unread,
Jun 26, 2012, 3:05:35 PM6/26/12
to django...@googlegroups.com
On Tue, Jun 26, 2012 at 11:40 AM, David Novakovic
<davidno...@gmail.com> wrote:
> Hey all,
>
> Is it possible to get a tuple of (sql, params) from an ORM queryset?

Yep:

sql, params = qs.query.get_compiler('default').as_sql()

(Fancy meeting you here. :))

David Novakovic

unread,
Jun 27, 2012, 6:58:41 AM6/27/12
to django...@googlegroups.com
Fantastic, that's exactly what I need.. thanks Jeremy!

Yep, my first -users post :)
Reply all
Reply to author
Forward
0 new messages