Return to Snippet

Revision: 60198
at October 25, 2012 08:55 by inreflection7

Initial Code
def print_queries():                                                                                                
    from django.db import connections                                                                               
    for connection in connections.all():                                                                            
        print "queries for %s:"%(connection.alias,)                                                                 
        for i, query in enumerate(connection.queries):                                                              
            print "%s: %s"%(i, query)

Initial URL

Initial Description
Useful when used with views

Initial Title
Django DB alias and queries

Initial Tags

Initial Language