Git Product home page Git Product logo

django-queryinspect's People

Contributors

dimlev avatar dodobas avatar fdemmer avatar jairhenrique avatar jarcoal avatar mrjaba avatar onjin avatar orf avatar pegler avatar rhcarvalho avatar senko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-queryinspect's Issues

Some queries not caught

I've noted that a few queries aren't caught by this (terrific) plugin. Specifically, some of the Django-specific queries don't seem to show up in the output:

  • select ... from django_session
  • select ... from auth_user

Other middleware that logs SQL queries seem to catch these queries, so it's definitely possible. I think the issue may be that callproc isn't implemented in the CursorDebugWrapper class, and perhaps those canned queries are stored as procedures.

Django 1.8 compatible release missing.

The current release 0.0.4 causes deprecation warnings when used with Django 1.8.
The required changes seem to be present, the only thing missing is a new release.

ZeroDivisionError if there was only one query to database

Traceback (most recent call last):
  File "/home/onjin/Workspace/onjin/django-queryinspect/testproject/testapp/tests.py", line 19, in test_query_inspect
    response = self.client.get('/book/')
  File "/home/onjin/Workspace/onjin/django-queryinspect/.tox/py27_django14/local/lib/python2.7/site-packages/django/test/client.py", line 439, in get
    response = super(Client, self).get(path, data=data, **extra)
  File "/home/onjin/Workspace/onjin/django-queryinspect/.tox/py27_django14/local/lib/python2.7/site-packages/django/test/client.py", line 244, in get
    return self.request(**r)
  File "/home/onjin/Workspace/onjin/django-queryinspect/.tox/py27_django14/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 186, in get_response
    response = middleware_method(request, response)
  File "/home/onjin/Workspace/onjin/django-queryinspect/qinspect/middleware.py", line 197, in process_response
    self.check_stddev_limit(infos)
  File "/home/onjin/Workspace/onjin/django-queryinspect/qinspect/middleware.py", line 131, in check_stddev_limit
    stddev = math.sqrt((1.0 / (n - 1)) * (stddev_sum / n))
ZeroDivisionError: float division by zero

Total request time adds up with HTTP 404 responses

Using this with Django 1.9.12 and just observed, that the time reported in the stats continues to grow, with repeated 404 responses (via raise Http404). So after a while i get:

[SQL] 1 queries (0 duplicates), 0 ms SQL time, 175554 ms total request time

After a response with HTTP 200, the timer seems to reset.

Push a new release

Hey,
Django-queryinspect is pretty useful, but currently there is no release that supports 1.10. Can you push an update to PyPi?

Thanks! And thanks for this library ๐Ÿ‘

What do you think about making it more flexible?

This is an awesome project! Congrats! It'a amazing how complete it is.

For me it would be nice to be able to use the queryinspect programatically instead of coupling it to my project and making it depending on settings.

I teach a lot and work on many projects that need refactoring and performance improvements. So I think it would be great to use the inspector without the middleware.

I have some rudimentary solution for what I need with the logdb function fo sqlformatter. You can see the source at here.

Be decoupling the inspector from the predetermined workflow of a middleware one could:

  • use as a view decorator
  • use as a contextmanager
  • turn it on on the beginning of a process and off somewhere else.
  • easily integrate with other tools like django-debugtoolbar and django-devserver

If you feel this is aligned with your vision, I can do some work on that.

Again, congrats and thanks for sharing.

Is it thread-safe

As I know, middleware class is initialised once and shared by threads, in your class, your are using instance variables to store state, are you sure it is thread safe?

How to use it?

I follow the instructions but it seems like doesn't work.
Could you explain to me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.