[ANN] Caqti 1.7.0

I am pleased to announce the release of Caqti 1.7.0. Caqti is a generic RDBMS client interface supporting MariaDB, PostgreSQL, and Sqlite3 via the corresponding bindings to the client libraries. The full release notes follows.

v1.7.0 - 2022-02-13

New features:

  • Added a new query-string parser based on Angstrom. Its main advantage
    is that it can be used stand-alone e.g. to load SQL schemas from files
    split into individual statements which can be sent to the database.

  • Support passing a query environment to the connect and pool construction
    functions. This avoids using globals to modify the environment and
    facilitates e.g. targeting different database schemas with different
    connetions or connection pools.

  • A new Caqti_query.E case was added to support the two above cases.
    This is a breaking change, but hopefully does not break existing code.
    The exception (not counting module type of) would be if the
    constructors are aliased along with an alias of the type. On the other
    hand, pattern matching should be compatible since the new constructor is
    only emitted by newly introduced functions.

  • Added a module Caqti_request.Infix providing a new high-level API for
    constructing requests. It uses two-stage combinators, first to apply
    type arguments then to apply the query string. Apart from allowing
    nicer looking code, this solves the problem of switching to a the query
    string parser while maintaining backwards compatibility.

  • Added set_statement_timeout to connection modules, used to set query
    timeout. It is only supported for PostgreSQL and MariaDB. (#74)

  • Added with_transaction function to connection modules. This is just
    fail-safed wrapper around start, commit, and rollback.


  • Fixed delayed recovery of connection pools after loosing connections to
    PostgreSQL. Due to a missing call to consume inputs, the pool validator
    did not discover that a connection was lost before it was attempted

  • Improved resilience against exceptions and monadic errors in callbacks
    and fixed in-use checking.

  • Changed Sqlite3 driver to use non-linear parameters and improve error
    reporting when the wrong number of arguments are received (#77 & GPR#79
    Reynir Björnsson).

Other changes:

  • The Caqti license now uses the LGPL-3.0 Linking Exception instead of a
    rephrasing of the OCaml LGPL Linking Exception which was written for

  • Improved documentation, pretty-printing, logging, and exception details.

  • The test suite has been switched to use Alcotest; not without some
    struggle due to the use of test harness and argument-dependent test
    suite, but the result seems like a clear improvement.