Django SQL Sniffer
Project description
Django SQL Sniffer
A simple command line tool for analyzing Django ORM SQL execution from a running process. Minimally invasive and granular - no need to change the logging config or the source code of the target process, and no need to restart the process.
Usage
Install though pip
pip install django-sql-sniffer
Run the tool by passing it the target process id
django-sql-sniffer -p 76441
Ctrl + C to stop and show the query stats summary. Take a look at a short demo:
demo
By default, stats summary shows queries sorted by max duration; the possible options include:
-tprint queries in tail mode, i.e. as they are executed-csort stats summary by query count-ssort stats summary by total combined query duration-nset the number of top queries to display in stats summary-vfor verbose logging mode on both the client and server side- if OS supports
SIGINFOsignal pressCtrl + Tto display snapshot stats summary without killing the process
How it works
The tool is composed out of a client and a server. Running django-sql-sniffer starts the server, which then
injects the client into the running process using GDB/LLDB and waits for it to connect.
The client monkey patches the Django DB cursor and starts streaming queries to the server as they are executed.
The queries are then collected and analyzed on the server side.
Finally, when the server gets a shutdown signal, it stops the client which in turn rolls back the monkey patch leaving
the target process in the original state.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-sql-sniffer-1.0.3.tar.gz.
File metadata
- Download URL: django-sql-sniffer-1.0.3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df4052ca76c4f4cb97b14e120c22d9845937e33862b35c50709e3d9a022e9a15
|
|
| MD5 |
9c0a46130ec694fbd65ec08d1c5fc414
|
|
| BLAKE2b-256 |
4ff9df1b11961f799e534b192693f611ccd18280efdeaec9f834161c10ccd75e
|
File details
Details for the file django_sql_sniffer-1.0.3-py3-none-any.whl.
File metadata
- Download URL: django_sql_sniffer-1.0.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b335c538e57c6f4a00685db5f3159446e25d256ebae1ffaf4f67a00a5ef414d2
|
|
| MD5 |
5b85c77466e611803d8e8a369ce8b49e
|
|
| BLAKE2b-256 |
1dc3c6ef078d03a57f93e2e234c16595472c1122504af7e3ab9f6b322dba82fd
|