How to obtain the SQL query from the queryset?

Last updated 4 years ago | 1518 views 75     5

Tags:- Django

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

post = Post.objects.all()

print(post.query)