CLI tool to analyze Django ORM filter, exclude, and annotate usage on a specific model.
Project description
README.md
record-query-analysis
record-query-analysis is a command-line tool for analyzing Django ORM usage of .filter(), .exclude(), and .annotate() on a specific model across a Python codebase.
🔍 Features
- Detects chained querysets on a target model (e.g.,
Record.objects.filter(...).annotate(...)) - Extracts used fields in
filter,exclude, andannotate - Aggregates and counts unique field combinations
- Outputs results in table, JSON, or CSV formats
🚀 Installation
pip install -e . # or build via uv, poetry, etc.
🧪 Usage
record-query-analysis path/to/your/codebase --model=Record --output-format=table
Options:
--model: Django model name (default:Record)--output-format:table(default),json, orcsv--csv-file: custom file path for CSV output
📦 Example Output
Filter/Exclude Fields | Annotate Fields | Frequency | Locations
-----------------------------------------------------------------------------------------------
is_active, location_id | client | 12 |
↳ app/views/reports.py:45
📄 License
MIT License
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_query_index_analyzer-0.1.4.tar.gz.
File metadata
- Download URL: django_query_index_analyzer-0.1.4.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a739d0f1196be020e118bb720d38ae4e8840d72d1259a24592124816d61ac844
|
|
| MD5 |
03b5d000115eeca177dc2d840ebe604d
|
|
| BLAKE2b-256 |
3265ee8f699e1cb7ee0a38089022fd0722b03780583b2aae576a83e273b572df
|
Provenance
The following attestation bundles were made for django_query_index_analyzer-0.1.4.tar.gz:
Publisher:
ci.yml on eliziario/django_query_analyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_query_index_analyzer-0.1.4.tar.gz -
Subject digest:
a739d0f1196be020e118bb720d38ae4e8840d72d1259a24592124816d61ac844 - Sigstore transparency entry: 212418422
- Sigstore integration time:
-
Permalink:
eliziario/django_query_analyzer@e4895d00020ce43e2911585cfe6bd24c20484477 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/eliziario
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e4895d00020ce43e2911585cfe6bd24c20484477 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_query_index_analyzer-0.1.4-py3-none-any.whl.
File metadata
- Download URL: django_query_index_analyzer-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19ed4b249b3e5845323b5945fff7e522e77ccba60ce0893002807cff0a4b4178
|
|
| MD5 |
08449a1f05c9bd98e036f572beafbf14
|
|
| BLAKE2b-256 |
3ad4adb576359ac6ac58b4a0ff358b5f9e70a24128a13418343f9b057c057d8a
|
Provenance
The following attestation bundles were made for django_query_index_analyzer-0.1.4-py3-none-any.whl:
Publisher:
ci.yml on eliziario/django_query_analyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_query_index_analyzer-0.1.4-py3-none-any.whl -
Subject digest:
19ed4b249b3e5845323b5945fff7e522e77ccba60ce0893002807cff0a4b4178 - Sigstore transparency entry: 212418426
- Sigstore integration time:
-
Permalink:
eliziario/django_query_analyzer@e4895d00020ce43e2911585cfe6bd24c20484477 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/eliziario
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e4895d00020ce43e2911585cfe6bd24c20484477 -
Trigger Event:
release
-
Statement type: