3 ms·
One of the best things about SQLAlchemy is SQLAlchemy Core in my opinion. It is the layer on which SQLAlchemy ORM is built. There are often times when an ORM is
by rkrzr 11y ago
One of the best things about SQLAlchemy is SQLAlchemy Core in my opinion. It is the layer on which SQLAlchemy ORM is built. There are often times when an ORM is overkill or when you really just want a lot of control over your SQL or you just don't want to learn yet another ORM and just want to write SQL with the added advantage of it being safe, easily composable and which can be passed around as Python objects.
So if you are thinking about using SQLAlchemy you should make a conscious decision whether Core or the ORM are better suited for the problem at hand.
- rch 11y agoThe core is a killer feature for sure, and essential in some cases. With a bit of pre-planning it doesn't need to be an either-or proposition though.
- rkrzr 11y agoGood point. It's true that you can successfully use Core and the ORM in the same project. Since the ORM is basically just a higher layer of abstraction (and is cleanly separated), you can always drop down to Core, if that's required. You only have to be careful in some situations when you do something "behind the back" of the ORM, so that it doesn't get confused. But that's usually also pretty straightforward in my experience.