I get the other side, though. When things are more complex and they go wrong, figuring out what magic has broken isn't fun. That little .filter() is dependent on hundreds or thousands of lines of code. I'd much rather just look at a SQL query. And I can do that in most ORMs, but since it's created dynamically, maybe it changes in weird ways.
What about a code generator? Not in the dynamic sense, but something that just generates code which I copy into my codebase. Maybe as a function. That generated code is then unaffected by changes in the ORM. That could be good or bad, but it's certainly different. Maybe the "repetitive task" that my coding brain is trying to get me out of isn't the SQL query and marshalling, but the writing of the SQL and marshalling code. Maybe I should just automate that.
I'm sure this isn't a new idea. But, I consider myself pretty in-the-loop and haven't seen it done before. Since other people are pretty smart too, it seems like there should be a reason. Anyone know why this isn't a popular way to do things?
https://www.jooq.org/doc/3.14/manual/code-generation/
It can be used without code generation as a SQL builder, but using the code generator takes it to the next level.
One reason the code generation approach might not be popular is because it adds complexity to the build, and most developers are (rightly) cautious about adding build complexity.