Skip to content

Instantly share code, notes, and snippets.

@damirazo
Last active December 22, 2020 23:57
Show Gist options
  • Save damirazo/8d55a0e1f7c6206da5fdd452fa2dbff8 to your computer and use it in GitHub Desktop.
Save damirazo/8d55a0e1f7c6206da5fdd452fa2dbff8 to your computer and use it in GitHub Desktop.
Django ORM Raw Query - сниппет для отображения корректных запросов, улетающих в СУБД от Django ORM
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