Created
April 6, 2021 21:21
-
-
Save berlotto/0c51b499af6adaa6544a5eacbb0fd860 to your computer and use it in GitHub Desktop.
How to print pretty Django Querysets query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlparse | |
def pquery(qs): | |
# Pretty Print Queryset querys | |
statement = str(qs.query) | |
print sqlparse.format(statement, reindent=True, keyword_case='upper') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment