Eric Floehr schrieb:
> from django.db import connection
> class Logging:
> def process_response(self, request, response):
> for query in connection.queries:
> print "[%s] %s" % (query['time'], "
> ".join(query['sql'].split()))
> return response
>
> Which results in
Thanks James, that did the trick. For others that may be looking, here
is my solution:
In my settings file I added below the middleware setting:
if DEBUG:
MIDDLEWARE_CLASSES += ('web.middleware.Logging',)
and in a file called "middleware.py" in my project directory (/web):
from django.db
I have a similar solution/problem...
Firstly, my "solution" was to create a method in my vews.py like this...
def my_render(request, template, dict):
url_time = 0
try:
for query in connection.queries:
log( query['time'] + "\t" + query['sql'
On 11/28/06, Eric Floehr <[EMAIL PROTECTED]> wrote:
> Does this mean that connection.queries isn't "global"? When do
> connections get created and destroyed? How can I dump an array of ALL
> queries and query times since the server started?
The value of 'connection.queries' will persist only as
Thanks James, that makes sense!
I think I still have a problem though...I was trying a simple example
of a problem I am having. I wanted to create a page that would show
all the queries and their times, for performance checking. So I would
do various things on the website, which would get actua
On 11/28/06, Eric Floehr <[EMAIL PROTECTED]> wrote:
> >>> DEBUG=True
> >>> from myapp.models.references import Stuff
> >>> from django.db import connection
> >>> p = Stuff.objects.all()
> >>> print connection.queries
> []
This doesn't add anything to 'connection.queries' because it hasn't
actuall
Hi!
I am trying to benchmark query times, and I can't seem to get
connection.queries to have anything except when I run
cursor().execute() myself. Here is an example to better illustrate my
question:
>>> DEBUG=True
>>> from myapp.models.references import Stuff
>>> from django.db import connecti
7 matches
Mail list logo