9 comments

[ 1.9 ms ] story [ 36.8 ms ] thread
Man, I'm gonna give SQLAlchemy another try after this release i think.

I've not been able to shake the simplicity and intuitiveness of the Django ORM. The fact is in most apps you just need the basic stuff. But you do hit the limitations too quickly. SQLAlchemy always felt like too big/crufty a tool to use at the early stages.

OTOH when I've wanted to make serious sql-based tools it's been invaluable. I hope it'll lend itself better to the simpler use cases, I'd love to switch my default backend stack to FastAPI with SQLAlchemy.

IMHO once you understand it well, even for simple things the Django ORM will drive you nuts. It's just a really limiting design compared to SQLAlchemy's data mapper.
I've been using plain sql, materialized views with postgrest for network endpoints. Therefore I don't need to maintain a backend.

Is there any compelling reason to try out an ORM?

If you're doing fine without an ORM, don't bring one in. ORMs bring some user-friendliness and other niceties, but might drive you crazy by their strictness (objects lifetimes are bound to a session, it is harder to fetch/update parts of an object/relation, async is much more difficult because of lifetimes again, still need to take a look at generated queries to spot performance issues, ...). I am myself in the process of moving from the ORM to the core, because while I need the multi-backend support (including migrations), the ORM is proving too tricky for an app that's growing beyond simple CRUD.
I think you should try out the ORM outside the context of your application to get some familiarity. I don't think you should foist it on your existing app for no reason. Learning SQLAlchemy is a solid investment if you are working with Python and are going to be working with relational databases.