during the last month i've dedicated myself to the study of Flask, a python framework for building web application.
Following different tutorials i've found online, I've discovered SQLAlchemy.
To be honest, i find it complicated and not really useful since i have a pretty good knowledge of SQL language.
What i want to understand is if there is any major gain in using ORM like SQLAlchemy that i'm missing (maybe some security issue in using pure sql that i don't know about?).
Also, i would appreciate if you could advice me of what's the best python library for working with pure SQL queries.
Performance. Since ORMs usually execute SQL queries under the hood, they can only hope to match the performance of an equivalent optimized SQL query; in practice, though, ORMs are often much slower. Nested fetch operations are typically split into a set of simpler, serially-executed SQL queries.
ORM and SQL are two tools available that web developers can use in database management. When comparing them, SQL has a higher hands-on management than ORM. Because ORM has a higher level of abstraction and more complexity than SQL, less hands-on management is required; this makes data management more efficient.
ORM is good only for developers and maintenance because most developers aren't very good at SQL, but if you're actually talking about performance, SQL completely trumps it.
So we can see that for a small number of queries SQLAlchemy wins hands down. While for a large number of queries they are almost the same. Only when we reach the need for having around 400 connections, then we need to give this a second thought.
There are many. The biggest advantages I see of using ORM instead of raw SQL queries are:
Even though they have some side-effects as well:
I like ORMs due to the advantages I mentioned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With