by ryanar · 9y ago · 0 comments
In my work with Django's ORM I have run into problem queries as often as I have with doing SQL, and Django's ORM has never let me down.
ORM keeps your thinking in line with your object oriented code, and I find it very easy and natural to use. Who cares if there are a bunch of artificial keys underneath, imo caching queries is a better solution to slow queries than trying to optimize SQL. So using the ORM is never a pain point.
The other advantage is automatic escaping to prevent SQL injection, which is still a top contender on OWASP's list. I never have to worry ahout SQL injection when using the ORM.
Maybe other ORMs are poor solutions, but at least with Django I have been very happy using it.
I find it to be extremely simple to work with. It also does a fantastic job generating efficient queries due to the way it forces you to structure your models. The `F`, `Q`, and aggregation functions are top-notch as well. If none of the ORM features suit you for a particular query, Django ORM allows you to write the raw query yourself in a secure manner. Couple this with the Migration system, and I doubt you'll find a better ORM suite anywhere else.
I find Python has some of the best ORMs out there between Django ORM, SQLAlchemy, Peewee, and Pony.