3 ms·
The concept of ORM isn't necessarily bad, it's just that most ORMs are terrible and try to map too much of relational algebra to objects, even if it is a bad fi
by lucian1900 15y ago
The concept of ORM isn't necessarily bad, it's just that most ORMs are terrible and try to map too much of relational algebra to objects, even if it is a bad fit.
Good ORMs like SQLAlchemy first model a relational database and then build the object bits on top of that. That's why you can do an explicit outer join between models so you end up making a constant number of queries (instead of n queries with the naive attribute fetch in a loop).
One almost never has to write SQL when using SQLAlchemy, as opposed to, for example, Django's ORM, which has a much more "mainstream" design. SQLAlchemy is more like a relational/SQL library + an optional ORM-like thing.