"The only problem I see, is we can't rewrite SQL."
I believe that the phrase you're looking for is "lack of compositionality".
I believe that the phrase you're looking for is "lack of compositionality".
It's only bridge between sqlparse and SQLAlchemy that's missing. I guess, just because nobody had a wish, will and time to finish and share one.
I think that this is the "every problem in CS can be solved by another layer of indirection" part. You're basically sidestepping the issue of SQL not providing the functionality in the first place.