2

Currently I am developing website in Django & I need to convert some djnago query to sql equivalent query.

Purchase_order.objects.filter(query).order_by(id)[start: (start+length)]

I want to convert above django query into sql type of query.

Is there any way availble to convert it into sql also.

Naveen Jain
  • 1,042
  • 7
  • 26
Jayesh
  • 41
  • 4
  • Possible duplicate of [How can I see the raw SQL queries Django is running?](https://stackoverflow.com/questions/1074212/how-can-i-see-the-raw-sql-queries-django-is-running) – Lord Elrond Oct 05 '19 at 00:28

1 Answers1

0

Yes. django does provides that feature. queryset comes with query object.

purchase_order = Purchase_order.objects.filter(query).order_by(id)[start: (start+length)]  

print(purchase_order.query)  

this will print corresponding query.

Naveen Jain
  • 1,042
  • 7
  • 26