How to obtain the SQL query from the queryset?

Last updated 4 years, 3 months ago | 1665 views 75     5

Tags:- Django

Using the query method we can print SQL query from the queryset

post = Post.objects.all()

print(post.query)