Django how do i view query in manage shell -


how can see django queries manage shell interface

i have tried using gives me queries pass through django server

from django.db import connection connection.queries() 

i have seen somewhere, can't remember where??

django how view query in manage shell

there 2 ways view query in shell. first, if using queryset can use query attribute of queryset. e.g.

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

second when query not visible immediately. e.g. when updating queryset using update(). in case can:

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

i have tried using gives me queries pass through django server

i don't understand mean "gives me queries pass through django server". trying see queries while running application? in case use django-debug-toolbar or snippet referred @rubayeet.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -