I have an exec-runner and a query-runner in my company's curiosity.components.jdbc
that take our jdbc pool component and a honeysql map and then formats it and queries/executes it. We add in a few other things that didn't exist at the time like statement debugging and explain/explain analysis as options via dynamic binds
most of our code looks like (->> (build-some-map) (query-runner db))
handy because we can test the logic for complicated queries or pull them out and explain them in the repl
we have (with-query-logged ...)
and (with-query-explained ...)
Sounds like a good approach @bja!
composing honeysql maps over time has been the only way to stay sane while generating reasonable performant reporting / dashboarding queries
we use a bunch of non-standard SQL features of postgresql and honeysql makes it trivial to support the extra stuff and then live in the usual clojure ecosystem of manipulating maps
it's a big deal when you need to do complicated subqueries or CTEs
being able to take a known-working query map, merge a little extra in and then use that as the basis for a CTE would take a ton of time if I was writing SQL (or using most ORMs)