Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1898756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:48:26+00:00 2026-05-17T06:48:26+00:00

How can i see my django queries from manage shell interface I have tried

  • 0

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??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:48:27+00:00Added an answer on May 17, 2026 at 6:48 am

    Django how do i view query in manage shell

    There are two ways to view the query in the shell. First, if you are using a queryset you can use the query attribute of the queryset. For e.g.

    qs = MyModel.objects.all()
    print(qs.query)
    

    Second when the query is not visible immediately. For e.g. when you are updating a queryset using update(). In this case you can:

    from django.db import connection
    MyModel.objects.all().update(foo = 'bar')
    print(connection.queries)
    # print(connection.queries[-1]) # if you want to see only the last query
    

    I have tried using this but gives me queries that pass through the django server

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see tons of questions that are related to this but I can't figure
I have a django test site and I can see the admin site, but
(r'^media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.MEDIA_ROOT}), As you can see, I have a directory called media under
I have a failing model.save() in my Django app. How can I see the
I'm trying to show thumbnail images in Django admin, but I can only see
I can see that GD library is for images. But I can't see differences
I can see some potential difficulties with this concept but the idea is: I
I'm using the Python shell in Django to make some queries. The results keep
I can see that django looks for 500.html when DEBUG is False . What
By default, I can see Delete the selected user action from django user admin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.