Add light object to SQL mapping support to generate queries based on attributes#3717
Add light object to SQL mapping support to generate queries based on attributes#3717remysaissy wants to merge 1 commit intolaunchbadge:mainfrom
Conversation
fbdf8d6 to
85d6931
Compare
|
I don't really see why this needs to be in SQLx specifically. It seems like it could easily be developed and incubated as a separate crate, like the half-dozen or so other ORMs already built on SQLx. Look at it this way: if you were planning on maintaining it long-term, you wouldn't be beholden to our release cycle and you could evolve independently. If you weren't, then you'd otherwise be dumping a nontrivial additional API surface on us that we'd likely have to maintain in perpetuity--an API design that I personally would probably not use. Understand that we developed SQLx largely out of a frustration with ORMs. We make it clear in the README that SQLx is not an ORM for a reason. They hide the actual SQL being executed from you, making it much harder to debug issues or understand the performance implications of your code. They often do a lot of unnecessary extra work, like for example, selecting whole rows even when you only need one field (which the database could otherwise serve with an index-only scan). You end up having to jump through a lot of hoops to make any tweaks you might need. And knowledge of one ORM isn't really portable to any other language or framework. The designed intent of SQLx is to empower people to just write SQL. We have a long ways to go in terms of developer experience, but any convenience layers we add should be in-line with that core ethos, like #875 (which I'd love to get back to when I get the chance). I'm also concerned that the existence of this would end up confusing a lot of users. Many will likely expect it to integrate into the compile-time checks somehow; this is already an issue with That also strongly suggests that this doesn't really need to be in SQLx itself, as it doesn't seem to rely on any internal APIs--though if you do end up needing some, we could discuss exposing them. |
|
Hi, I will close the draft, this can live as a different crate. thanks! |
Fixes #3718