View on GitHub


Documenting everything about OCaml




Note: Libraries with over 100 stars on GitHub are marked “Popular”.

  • camltc: OCaml bindings to Tokyo Cabinet.
  • Caqti: Popular. monadic, asynchronous common interface to relational databases.
    • Currently supports MariaDB, PostgreSQL and SQLite3.
  • Dbm: a binding to the NDBM/GDBM Unix “databases”.
  • ezpostgresql: simple, non-type-safe interface to PostgreSQL. Prioritizes simplicity.
    • Wraps around PostgreSQL-OCaml.
  • Mongo: OCaml driver for Mongodb
  • mysql8: Bindings to the latest version of the mysql database.
  • mysql_protocol: implementation of MySQL Protocol with the Bitstring library.
  • OCaml-mariahdb: OCaml bindings to MariahDB interface.
  • ocaml-redis: Redis bindings for OCaml.
  • ocaml-sql-query: Experimental functional wrapper over SQL queries.
  • orocksdb: OCaml RocksDB bindings using ctypes.
  • Petrol: Provides a high-level, type-safe API that allows defining SQL tables and queries directly in OCaml rather than writing SQL code.
  • PG’OCaml: Popular. PostgreSQL client in pure OCaml.
    • Includes a PPX that provides compile-time checking of SQL syntax and types.
  • PGX: Popular. A pure-OCaml PostgreSQL client library, supporting Async, LWT, or synchronous operations.
  • PostgreSQL-OCaml: Popular. A low-level interface to PostgreSQL through the C API (libpq).
  • ppx_mysql: Syntax extension for mysql bindings.
  • ppx_pgsql: a syntax extension for embedded SQL queries using PG’OCaml.
  • ppx_rapper: Popular. A syntax extension for PostgreSQL using Caqti
  • SQLite3-OCaml: Popular. OCaml bindings to the SQLite3 database.
  • Sqlite3EZ: thin wrapper for SQLite3 with a simplified interface.

Out of Date

  • mysql: (Older version of mysql) mysql library.
  • Sequoia: (Needs update to latest OCaml) Create type-safe queries.
    • Currently with bindings to MySQL/MariaDB and SQLite.

OCaml Databases

  • Arakoon: a consistent distributed key-value store built on top of Tokyo Cabinet.
  • Irmin: a distributed database that follows the same design principles as Git.
    • A fairly through tutorial for Irmin can be found here.
  • Obigstore: a database with BigTable-like data model atop LevelDB.
  • RunOrg: a WIP database server written in OCaml.


  • Macaque: Macaque is a library for safe and flexible database queries using comprehensions on top of PG’OCaml.
  • ORM: ORM for SQLite.

Articles & Examples