7 ms·
In what way "most powerful"? If you do anything more involved than CRUD it falls apart pretty fast. You can't express most of the things you can do with raw SQL
by fleetfox 2y ago
In what way "most powerful"? If you do anything more involved than CRUD it falls apart pretty fast. You can't express most of the things you can do with raw SQL since there is not intermediate DSL like you do with SQLA. You can't hydrate arbitrary object graphs. It's slow, for deep queries building back objects is slower than actual SQL round trip.
It's very easy to use but it's also very limited and i often find myself dropping down to RawSQL or even having SQLA connection in my Django projects.
- SheepSlapper 2y agoThen you might not be in the target audience of Django. For the rest of us, the ORM is dope as hell and nobody cares that you aren't writing the most performant SQL the world has ever seen...
- rossant 2y agoThe ORM is fantastic and I never use raw SQL, but I can see how it may be simpler to just go straight to raw SQL with complicated database structures and queries.
- Maxion 2y agoThe best part about it though is that you can use raw SQL and the ORM at the same time. In larger projects that's how I've always used it. ORM for the majority of use cases, and the raw SQL where performance really matters.
- selcuka 2y agoWhich other Python based ORM addresses those issues?
- fleetfox 2y agoSQLAlchemy does. I get that DjangoORM is more convenient and might be good enough. But powerful seems like wrong adjective.
- winrid 2y agoPowerful in terms of productivity. The occasional N+1 query problem here and there isn't a big issue for many projects and means you can launch 10x faster than someone using some other technologies. If you're successful, you can easily write raw SQL and optimize as needed.
- selcuka 2y agoAh, sorry. It wasn't clear that SQLA meant SQLAlchemy in your first comment.
- pjerem 2y agoDjangoORM isn’t perfect but its power comes from the fact it is heavily integrated with Django (the framework).