Chris Lamb

django-append-url-to-sql

BlogProjectsAbout

View all my projects »

Appends the request URL to SQL statements in Django.


Whilst the Django Debug Toolbar is invaluable for development in a local environment, it cannot help you identify misbehaving queries in production. To assist in this task, django-append-url-to-sql appends the request URL as a comment to every SQL statement that is executed. For example:

SELECT "auth_user"."id", [..] WHERE "auth_user"."id" = 1 -- /login

This makes it possible to go from SELECT * FROM pg_stat_activity or SHOW PROCESSLIST output to the view that is executing it.

If the current request URL cannot be determined, nothing is appended.


If you are looking for a highly experienced full-stack Django developer with a track record of producing high-quality and maintaininable code, please get in touch.

You can browse the source tree, create or file bugs or download the code from Git:

$ git clone https://github.com/lamby/django-append-url-to-sql

django-append-url-to-sql is released under the MIT license.

View all my projects »