0

I want want to examine what django does with databse when I execute some statement with a django model
For instance

Group.members.all()

with manage.py shell.

Is there any way of doing this?

Nullpoet
  • 10,949
  • 20
  • 48
  • 65
  • possible duplicate of [django orm, how to view (or log) the executed query?](http://stackoverflow.com/questions/971667/django-orm-how-to-view-or-log-the-executed-query) – Ignacio Vazquez-Abrams Jun 28 '10 at 18:26

2 Answers2

2

You can use the Django Debug Toolbar.

AbeEstrada
  • 1,090
  • 1
  • 13
  • 15
  • +1. And for the shell, the debug toolbar adds an extra manage.py command - `debugsqlshell` that prints the SQL for every ORM command you type. – Daniel Roseman Jun 28 '10 at 18:59
1
print Group.members.all().query
Jason
  • 531
  • 3
  • 2