Is there a way to convert a raw SQL statement into a query? My SQL statement is very complicated, it seems it is over of the capacity of the ORM.
I can run my raw SQL perhaps, but I bumped into some problems with the paginator in this case. So it seems I should convert it to a query object.
Any ideas?