Hacker News new | ask | show | jobs
by anticodon 252 days ago
But why? Although I have way more experience with Django ORM, I find that SQLAlchemy is closer to SQL and I have to think less how to express complex queries. With Django ORM changing a few characters can change resulting query from LEFT JOIN to INNER JOIN, for example. I find it more difficult to write complex queries in Django ORM.
2 comments

Being closer to SQL in my projects meant that it had more footguns than C++ and developers had to know a lot about DB details to not break things.
I don't think it's unreasonable that devs should have to learn about database details to correctly use a database.

Could you list some specific examples where things broke because of SQLAlchemy's design?

Managing connections, connection looking and transactions was something that was always an issue with SQLalchemy for us. Migrations were significantly more terrible as well.
The only footgun is pretending that using an ORM means not having to learn SQL.
Exactly!

I like my ORMs based on SQL concepts, not OOP concepts.

So you do have to know SQL, but you get more convenient ways of generating it.

https://github.com/codr7/tyred

That's not what I said though.
Wait until you find out that the RDBMS optimizer may also sometimes convert your outer joins to inner joins.

I dislike all ORMs, but I especially dislike SQLAlchemy for its hideously bad docs.