Last active
December 22, 2020 23:57
-
-
Save damirazo/8d55a0e1f7c6206da5fdd452fa2dbff8 to your computer and use it in GitHub Desktop.
Django ORM Raw Query - сниппет для отображения корректных запросов, улетающих в СУБД от Django ORM
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
from django.db import connections | |
cursor = connections['default'].cursor() | |
# queryset заменить на имя переменной, содержащей QuerySet | |
print(f'{cursor.mogrify(*queryset.query.sql_with_params())}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment