> fair question is: why hasn’t the boilerplate been automated as libraries or other abstractions?
Sometimes it has. The amount of generated code that selected count(distinct id) from customers would produce is huge.