Based on Sid's answer and this snippet (http://djangosnippets.org/snippets/1973/), I replace the postgres dg wrapper with the following:
# base.py from django.db.backends.postgresql_psycopg2.base import * #http:
Then in settings.py
use 'ENGINE': 'my_project.db_backend'
instead of the default backend (in my case, 'ENGINE': 'django.db.backends.postgresql_psycopg2'
,)
Now connection.queries
will contain all your queries!
source share