3 ms·
Am I only person that prefers to use raw SQL over of SQLAlchemy? I do not see any real advantage of using SQLAlchemy over raw SQL if I do not plan (which I do n
by vasili111 4y ago
Am I only person that prefers to use raw SQL over of SQLAlchemy? I do not see any real advantage of using SQLAlchemy over raw SQL if I do not plan (which I do not plan) in future to switch DB engine for the application. Do you see any real advantage of using SQLALchemy over raw SQL queries if you do not plan to switch DB engine for your application in future?
- willseth 4y agoIt's nice to have all of your db operations in Python and automatically integrated with existing Python tooling. It also makes it easier to refactor, organize, etc. SQLAlchemy comes OOTB with a lot of nice convenience tools and functions, and there's an ecosystem built around it, e.g. Alembic for schema migration. There are some cases like really complex queries where it can get in the way, but overall I find the tradeoffs are easily worth it for the convenience
- dontlaugh 4y agoAlchemy makes it quite easy to compose queries, which isn’t possible with SQL. That’s about it.
- gghhzzgghhzz 4y agoI use it mostly for reverse engineering a model on top of a legacy database when working on projects to clean and migrate that data. I seen some very legacy database 'designs' and have never failed to model them with a combination of sqlalchemy join mapping, datatype mapping and some object properties in python for cases that are simpler to just express as list comprehensions. You end up with some data quality rules / Transformation logic you can reasonably share with business users. On the Load end I normally do that via sql bulk inserts as using an ORM just adds too much overhead and not enough control.
- piafraus 4y agoNo, I feel raw SQL is much cleaner and you can see immediately what will be executed, which indexes will be used, etc. No black-box magic.