Don't use your ORM entities for everything – embrace the SQL
blackparrotlabs.io
Don't use your ORM entities for everything – embrace the SQL
1–10 of 48 posts
Re: Don't use your ORM entities for everything – embrace the SQL
#2Re: Don't use your ORM entities for everything – embrace the SQL
#3Re: Don't use your ORM entities for everything – embrace the SQL
#4Re: Don't use your ORM entities for everything – embrace the SQL
#5Personally I just pick either PostgreSQL or SQLite depending on my use case (and they're different enough that there is always one obvious choice) and just interface with them directly. Hasn't served me wrong yet.
Re: Don't use your ORM entities for everything – embrace the SQL
#6It's funny that the same developers that try to avoid vendor lock-in don't realize they've locked themselves into an ORM forever.
Plus, SQL isn't that hard. And as a backend person, you should be able to visualize your data model anyway. A SQL datatbase is just a bunch of planes, for the most part, and the queries are how you intersect them...more or less.
Re: Don't use your ORM entities for everything – embrace the SQL
#7You write SQL but instead of getting back flat and potentially-collided data, you get back pure objects which are properly structured.
Re: Don't use your ORM entities for everything – embrace the SQL
#8I think the correct approach is to understand the SQL that your ORM is using. If you can't have it create the correct query than roll your own. I think most of the trouble people get in with ORMs is not taking the time to understand the SQL that it creates and using it incorrectly as a result.
In my space of Python SQLalchemy has been the dominate ORM of choice and I hated it but without putting out a better product I have just decided to work around it or adapt.
But if I can I use raw SQL where possible.
Re: Don't use your ORM entities for everything – embrace the SQL
#9I still don't understand why people believe that abstracting away something as important as your data store is a good idea. They quickly run into performance problems that are quite difficult to fix. It's funny that the same developers that try to avoid vendor lock-in don't realize they've locked themselves into an ORM forever. Plus, SQL isn't that hard. And as a backend person, you should be able to visualize your d…
[0]: https://kysely.dev/
Re: Don't use your ORM entities for everything – embrace the SQL
#10Coming from a Rails legacy app, these raw SQL "clever ideas" are where I found the most issues.