An ORMish thing that considers its primary purpose to enable metaprogramming SQL is actually useful.
In http://p3rl.org/DBIx::Class perl has had such a thing for over a decade now.
It makes me cry that nobody's ever adequately cloned it into other languages. Eventually I'll probably do so myself.