A monadic cooperative-threaded OCaml connector API for relational databases with driver support for MariaDB, PostgreSQL, and SQLite.
Caqti is a database connectivity library for OCaml that provides a uniform, monadic API for accessing relational databases like PostgreSQL, MariaDB, and SQLite. It solves the problem of database dependency by allowing applications to connect to different databases using a common interface, with built-in type-safe query parameter handling.
OCaml developers building database-backed applications who need database agnosticism, type safety, and support for various concurrency models like Lwt or Async.
Developers choose Caqti for its minimal design that avoids locking them into a specific database, its support for multiple async runtimes, and its focus on being a stable foundation for higher-level tools rather than an ORM.
Cooperative-threaded access to relational data
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
URI-based connections (e.g., postgresql:// or mariadb://) allow switching between supported databases without code changes, as outlined in the README's driver table.
Handles query parameter templating with declared OCaml types, ensuring compile-time type safety and reducing runtime errors, as demonstrated in the tutorial examples.
Integrates with multiple async runtimes like Lwt, Async, Eio, and Miou, providing adaptability for different OCaml application architectures.
Offers an experimental pgx driver for unikernel environments, enabling database access in MirageOS projects, though it's not recommended for production.
Only supports three databases (PostgreSQL, MariaDB, SQLite) with no native drivers for others like MySQL or NoSQL systems, restricting database choice.
Key features such as the MirageOS pgx driver and Eio/Miou connectors are labeled experimental, posing stability risks for production deployments.
Dynamic loading fails under utop, requiring static linking and workarounds for interactive development, as noted in the README's utop section.