3 ms·
Do you have any examples of queries you've found difficult to express using the Django ORM? I'm geniuiny interested in hearing - I've been using it for 5+ years
by simonw 13y ago
Do you have any examples of queries you've found difficult to express using the Django ORM? I'm geniuiny interested in hearing - I've been using it for 5+ years now and I rarely find the need to step outside it. I frequently write queries that do joins across 6 or more tables with count aggregations in single lines of Python code with it.
- taude 13y agoI don't with me. A common workflow ended up being for me was write the complex query in SQL (because it wasn't obvious to get going in the ORM), and then spend a long time reverse engineer it to get it to work in the Django ORM. Lots of joins, sub-selects, ordering, grabbing the latest single record from time sorted in the middle, etc. In the end, I had to think about how to use the ORM, and then I still needed to know the SQL for optimizations...