﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13101	Documentation: Add note about multiple databases and debugging raw sql	anonymous	David Fischer	"http://docs.djangoproject.com/en/dev/faq/models/ has a section called ""How can I see the raw SQL queries Django is running?"", where it suggests:

{{{
>>> from django.db import connection
>>> connection.queries
[{'sql': 'SELECT polls_polls.id,polls_polls.question,polls_polls.pub_date FROM polls_polls',
'time': '0.002'}]

}}}
However, in a multidb scenario, that only gets the sql from the default connection. I found a better way is this function:
{{{
def get_sql():
    from django import db
    q = []
    for c in db.connections.all():
        q.extend(c.queries)
    return q
}}}

A note should probably be made about this."		closed	Documentation	dev		fixed	multidb, 1.2, debug	djfische@…	Ready for checkin	1	0	0	0	0	0
