
Django Query Inspector - senko
https://github.com/dobarkod/django-queryinspect
======
jlafon
For those interested, here are a couple of differences between this and
django-debug-toolbar (an excellent, widely used utility that also provides SQL
inspection).

1\. django-debug-toolbar can be difficult to enable if you aren't serving from
localhost (for security reasons, because your settings are included in the
UI). This project looks much simpler to enable, as you just set DEBUG=True in
your settings.

2\. django-debug-toolbar provides its information through a UI component
embedded in your own UIs, but it doesn't help you with profiling HTTP APIs
that don't have a UI. In contrast, this project puts some profiling
information in the response headers, and SQL logs are sent to a logger. I
think this use case is where Django Query Inspector shows a lot of utility.

~~~
StavrosK
I don't understand #1. You can have DjDT show up only on a condition, e.g.
when someone is a superuser. Isn't it the same as this project?

~~~
jlafon
What I meant is that getting the toolbar to show up when you aren't serving
from localhost isn't as trivial as setting DEBUG=True. It requires other
settings ([https://github.com/django-debug-toolbar/django-debug-
toolbar...](https://github.com/django-debug-toolbar/django-debug-
toolbar/blob/f1a30456cf2a85bf45e5bc0d8c95fd2ac3fc23a7/debug_toolbar/middleware.py#L26))
which can be annoying to configure.

------
shabble
Always nice to see more tools, and the X- headers idea is pretty neat. I've
been using a mix of django-debug-toolbar (mentioned repeatedly in this
thread), and django-devserver[1], which is more useful when writing non-html
serving APIs and suchlike where a toolbar doesn't make sense.

[1] [https://github.com/dcramer/django-
devserver](https://github.com/dcramer/django-devserver)

------
aweb
This is a nice tool, although I really like the Django Debug Toolbar, which
does that and a bit more: [https://github.com/django-debug-toolbar/django-
debug-toolbar](https://github.com/django-debug-toolbar/django-debug-toolbar)

~~~
senko
I love DjDT, but it doesn't detect duplicate queries and can't be used for
non-HTML responses (eg JSON APIs).

~~~
leetrout
I have a hack for that!

[https://gist.github.com/leetrout/ab136dbfb97f8ee1d309](https://gist.github.com/leetrout/ab136dbfb97f8ee1d309)

;)

Edit: After install appending `?dbg=1` to a JSON returning view will inject
the html wrapper. e.g.
[http://foo.com/bar.json?dbg=1](http://foo.com/bar.json?dbg=1)

------
mjs7231
Shameless self promotion: Here is a decorator I wrote to help me inspect
performance issues using Django's DOM. The nice thing about this over Django-
Debug-Toolbar is that it runs single function rather than the whole view
helping you narrow down an issue. You can also add filters to remove unwanted
noise during your analysis.

[http://pushingkarma.com/notebook/django-decorator-print-
sql-...](http://pushingkarma.com/notebook/django-decorator-print-sql-queries/)

------
epicserver
Theres also silk
([https://github.com/mtford90/silk](https://github.com/mtford90/silk)) which
was posted recently. It doesnt seem to do the duplicate detection as yours
does but does provide a UI and works with APIs. Also gives you a history.

------
Joeri
I love tools like these.

The developer probably wasn't aware of it but there's an opensource project
which is trying to get a standardized profiler going for all web dev
platforms: [http://miniprofiler.com](http://miniprofiler.com)

It would be good to see projects like this done on top of the miniprofiler
base.

------
noise
Probably nobody is looking at this thread now, but just in case... I've had
similar code I use in Flask apps for awhile now and this project inspired me
to turn it into a legit Flask Extension:

[https://github.com/noise/flask-queryinspect](https://github.com/noise/flask-
queryinspect)

------
googletron
This is very cool and light, I also love not having to bob, back and forth
between terminal and browser.

------
abhn
Looks good, Debug Toolbar stopped displaying for me recently (not been able to
work out why) and this looks useful for standalone SQL debugging.

