I'm disillusioned by ORMs and query builders, but I don't want to solve my abstraction problems by string manipulation, so I'm looking for a middle ground.

Do you know any tools for creating an ASG for a SQL query? It only has to be syntactically correct, and has to expose useful methods, no semantic guarantees needed.

I believe this would be a sweet spot for creating powerful SQL queries that support the whole spectrum with minimal safety guarantees.