Re: sql log

2007-03-26 Thread Greg Donald
On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > It (logging all queries), is also just not something that's usually that > useful. If you are trying to track down a particular problem, a more > targeted approach and some experiments at the interactive prompt, > combined with printing o

Re: sql log

2007-03-26 Thread Greg Donald
On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > You will get dozens or hundreds of queries with very little way to tell > which thread or process is doing the logging. Since all the requests > will be interleaved, this will be even harder to track. Serialisation is > also a problem: on

Re: sql log

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 20:22 -0500, Jeremy Dunck wrote: > On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > I > > did an experiment early last year to put in calls to the python logging > > module throughout various paths in Django. It had a noticeable impact. > > I had this on my list

Re: sql log

2007-03-26 Thread Jeremy Dunck
On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I > did an experiment early last year to put in calls to the python logging > module throughout various paths in Django. It had a noticeable impact. I had this on my list of things to do at some point. I'm not arguing to add logging her

Re: sql log

2007-03-26 Thread Malcolm Tredinnick
On Tue, 2007-03-27 at 11:09 +1000, Malcolm Tredinnick wrote: > On Mon, 2007-03-26 at 19:57 -0500, Greg Donald wrote: > > On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > If you want to capture every query automatically like this, you can edit > > > django/db/backends/util.py and put

Re: sql log

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 19:57 -0500, Greg Donald wrote: > On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > If you want to capture every query automatically like this, you can edit > > django/db/backends/util.py and put the logging to file in place inside > > the CursorDebugWrapper.execu

Re: sql log

2007-03-26 Thread Greg Donald
On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > If you want to capture every query automatically like this, you can edit > django/db/backends/util.py and put the logging to file in place inside > the CursorDebugWrapper.execute() method -- where it is currently > appending to self.db.qu

Re: sql log

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 12:12 -0500, Greg Donald wrote: > On 3/26/07, Tim Chase <[EMAIL PROTECTED]> wrote: > >result = render_to_response('foo.html', context) > >f = file('debug.txt', 'w') > >f.write(repr(connection.queries)) > >f.close() > >return result > > Where can I put thi

Re: sql log

2007-03-26 Thread James Bennett
On 3/26/07, gdonald <[EMAIL PROTECTED]> wrote: > I tried a couple of page reloads, stuff I know is querying the > database, still nothing. It resets at the end of each page load, and each request/response cycle gets its own copy, so you need to access it from within that. The 'debug' context proc

Re: sql log

2007-03-26 Thread Greg Donald
On 3/26/07, Tim Chase <[EMAIL PROTECTED]> wrote: >result = render_to_response('foo.html', context) >f = file('debug.txt', 'w') >f.write(repr(connection.queries)) >f.close() >return result Where can I put this so I get all queries for every request into a single file? > Altern

Re: sql log

2007-03-26 Thread Eric Walstad
Hey Greg, gdonald wrote: > On Mar 13, 5:03 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: >> http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running > > When I try this I get nothing: > >> python manage.py shell > In [1]: from settings import * > > I

Re: sql log

2007-03-26 Thread Tim Chase
> In [3]: from django.db import connection > > In [4]: connection.queries > Out[4]: [] > > I tried a couple of page reloads, stuff I know is querying the > database, still nothing. > > Any idea what I'm doing wrong? The connection.queries is only available within a session/transaction. Thus,

Re: sql log

2007-03-26 Thread gdonald
On Mar 13, 5:03 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running When I try this I get nothing: > python manage.py shell In [1]: from settings import * In [2]: DEBUG Out[2]: True In [3]: from dj

Re: sql log

2007-03-13 Thread akonsu
could you explain how to add it to an application exactly? the explanations given with the snippet are not enough for me. thanks konstantin On Mar 13, 8:25 pm, "Ross Poulton" <[EMAIL PROTECTED]> wrote: > On Mar 14, 8:54 am, "Greg Donald" <[EMAIL PROTECTED]> wrote: > > > How can I see the sql Dja

Re: sql log

2007-03-13 Thread Ross Poulton
On Mar 14, 8:54 am, "Greg Donald" <[EMAIL PROTECTED]> wrote: > How can I see the sql Django produces? There was a fantastic template snippet posted recently at DjangoSnippets - http://www.djangosnippets.org/snippets/93/ - I added this to an application and used its output to whither down a 380+ q

Re: sql log

2007-03-13 Thread James Bennett
On 3/13/07, Greg Donald <[EMAIL PROTECTED]> wrote: > How can I see the sql Django produces? Is it being logged somewhere > or can I configure Django to log it somewhere? I realize I can look > at the logs from my db server but I'm wanting just the queries > produced by Django itself. http://www

sql log

2007-03-13 Thread Greg Donald
How can I see the sql Django produces? Is it being logged somewhere or can I configure Django to log it somewhere? I realize I can look at the logs from my db server but I'm wanting just the queries produced by Django itself. Thanks, -- Greg Donald http://destiney.com/ --~--~-~--~--