What is currently best ORM in OCaml world?

I am new learn OCaml, I write Java currently.
I am looking for database ORM library for OCaml.
Some ORM library for OCaml similar Mybatis to Java world?

OCaml doesn’t really have ORMs in the same style as Java. It has more what I would call ‘FRM’ or ‘Functional Relational Mapper’. The idea behind them is you write SQL queries, and the FRM turns it into a function that you can call to run the query, and maps back the results into OCaml objects. Check out ppx_rapper for one example of this. Shameless plug: another example is my SQLite query library wrapper.

1 Like

I enjoy ppx_rapper as mentioned quite a bit.

Another option with what looks like a quality ppx facility for easy syntactic integration into your codebase is pgocaml, which takes a somewhat different approach to land in a similar spot w.r.t. compile-time checking of queries and such. (/ht @glennsl for pointing towards it @ [ANN] First release of PGX (Pure-OCaml PostgreSQL client) with some good discussion of pgocaml’s benefits).