[Answered ]-Django raw sql query

2👍

The easiest way to translate your Django query to SQL is to simply look at the SQL that Django generates: How can I see the raw SQL queries Django is running?

👤kdt

0👍

you can get corresponding query the way mentioned below:

queryset = Document.objects.annotate(num_users=Count(users))  
sql_query = queryset.query
print(sql_query)

Leave a comment