How can i see my django queries from manage shell interface
I have tried using this but gives me queries that pass through the django server
from django.db import connection
connection.queries()
I have seen it somewhere, can’t remember where??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are two ways to view the query in the shell. First, if you are using a queryset you can use the
queryattribute of the queryset. For e.g.Second when the query is not visible immediately. For e.g. when you are updating a queryset using
update(). In this case you can:I don’t understand what you mean by "gives me queries that pass through the Django server". Are you trying to see the queries while running the application? In that case use the django-debug-toolbar or the snippet referred to by @rubayeet.