How to obtain the SQL query from the queryset?

Last updated 3 years, 5 months ago | 1297 views 75     5

Tags:- Django

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

post = Post.objects.all()

print(post.query)