How to find the query associated with a queryset..?

Sometimes you want to know how a Django ORM makes our queries execute or what is the corresponding SQL of the code you are writing. This is very straightforward. Youn can get str of any queryset. query to get the SQL.
You have a model called Enquiry. For getting all records, you will write something like queryset =Enquiry.objects.all(),
then do str(queryset. query)

For Example





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Morgan Stanley Internship Experience

Django vs Flask: Which framework to choose

Experiences of a User-Centric Software Engineer

Web Developer Jargon Demystified!

Laravel Auth::routes() Email verification Reset password Authentication Registration routes

Scrum’s internal conflict of being a process or a framework

Having A Growth Mindset — How I Achieved This Recently

Python Program Dairies #1

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



More from Medium

Popular frameworks for development in 2022. Dealing with Laravel, Django and other options

Setting Up Django App

I will web API with python django rest framework drf

_mysql is not defined, Django on Mac M1 with MySQL DB