Re: finding out what SQL Django generated

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 5:39 PM, Justin Bronn wrote: > > > If it's docs links you want :) : > > > > http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-ra... > > This isn't in the docs, but it also works: > > >>> qs = Foo.objects.all() > >>> qs.query.as_sql() > > It returns a two-e

Re: finding out what SQL Django generated

2009-04-15 Thread Justin Bronn
> If it's docs links you want :) : > > http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-ra... This isn't in the docs, but it also works: >>> qs = Foo.objects.all() >>> qs.query.as_sql() It returns a two-element tuple comprised of the generated SQL and parameters, respectively.

Re: finding out what SQL Django generated

2009-04-15 Thread Chris Curvey
On Apr 15, 4:25 pm, Alex Gaynor wrote: > On Wed, Apr 15, 2009 at 4:23 PM, Chris Curvey wrote: > > > I'm getting unexpected results from a database query that was > > generated by Django, and I'm sure the problem is that I'm mis-using > > the API.  Is there a way to get Django to tell me what SQL

Re: finding out what SQL Django generated

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 4:23 PM, Chris Curvey wrote: > > I'm getting unexpected results from a database query that was > generated by Django, and I'm sure the problem is that I'm mis-using > the API. Is there a way to get Django to tell me what SQL was sent to > the database server? > > (Sorry i

finding out what SQL Django generated

2009-04-15 Thread Chris Curvey
I'm getting unexpected results from a database query that was generated by Django, and I'm sure the problem is that I'm mis-using the API. Is there a way to get Django to tell me what SQL was sent to the database server? (Sorry if this is a FAQ, I've been looking for a while. Pointers to docs g