Django DB alias and queries


/ Published in: Python
Save to your folder(s)

Useful when used with views


Copy this code and paste it in your HTML
  1. def print_queries():
  2. from django.db import connections
  3. for connection in connections.all():
  4. print "queries for %s:"%(connection.alias,)
  5. for i, query in enumerate(connection.queries):
  6. print "%s: %s"%(i, query)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.