Skip to main content

Advanced Usage

Each underlying database library and corresponding HugSQL adapter may support additional options for the execute/query commands. Functions defined by def-db-fns have a variable-arity 4th argument that passes any options through to the underlying database library.

Below is an assertion from the HugSQL test suite showing a query passing along the :as-arrays? option to Please note the required 3rd argument (the HugSQL-specific options) when using this passthrough feature:

(is (= [[:name] ["A"] ["B"]]
(select-ordered db
{:cols ["name"] :sort-by ["name"]} {} {:as-arrays? true})))

Please note that as of 0.5.8 and HugSQL 0.4.7, the above additional options are now required to be a hashmap instead of keyword arguments as in previous versions. In 0.5.8 the deprecated usage will emit a warning. In 0.6.0+ the usage is deprecated and not allowed. See the changelog for details.