Django.db.utils.NotSupportedError: (1235, "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'") in Django
I am building a Django application and trying to implement pagination on a large dataset for a report. When querying the database, I encounter the error: django.db.utils.NotSupportedError: (1235, "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'"). I'm using MySQL as the database backend.
order_queryset = ProformaHeader.objects.filter(process_this_order=True, status=ACTIVE)
page_obj = pagination(request, order_queryset.order_, per_page=10)
order_queryset = page_obj.object_list
podetails = PODetail.objects.filter(proforma__in=order_queryset, po_header__is_vconfirmed=True, status=ACTIVE).select_related('proforma_detail')
podetail_map = {p.proforma_detail_id: p for p in podetails} # I encounter the error this line
Error occurs on this line:
podetail_map = {p.proforma_detail_id: p for p in podetails} # I encounter the error this line
The error is raised when attempting to create a dictionary mapping proforma_detail_id
to the corresponding podetail
object. It seems to be related to the combination of LIMIT
and IN
in the query generated by Django when retrieving the podetails
.
Expected Outcome:
I expected this line to build a dictionary mapping proforma_detail_id
to podetail
without triggering an error, allowing me to reference the podetail
object for each proforma_detail
in the subsequent processing loop.