4 ms·
How does Flask + SQLAlchemy make it easier to build a REST interface than out-of-the-box Django?
by simonw 13y ago
How does Flask + SQLAlchemy make it easier to build a REST interface than out-of-the-box Django?
- taude 13y agoBecause the Django ORM is so limiting in so many aspects? It's great if your queries are simple...
- ubernostrum 13y agoI think the question was more along the lines of what bundled module or functionality in Flask + SQLAlchemy specifically and uniquely makes REST interfaces easy to build. Because I know of no such thing -- it's still very much roll-your-own or use a third-party library.
- simonw 13y agoDo 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...