Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
ANN: OCaml/Sqlite ORM layer (preview 0.2)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Anil Madhavapeddy <anil@r...>
Subject: ANN: OCaml/Sqlite ORM layer (preview 0.2)
I've been using OCaml in a few server projects which need a light- 
weight database, and so I wrote a library to map OCaml objects  
directly to a SQLite3 backend database.

Like other ORM systems, you define a schema based on sets of named  
fields.  The Sql_orm library then generates an OCaml module and  
interface with static accessor methods which take care of all the  
tedious SQL interactions and provide you with a nice high-level,  
statically type-safe access method.

It's still early days but the library is very functional and stable.   
I've put up docs and instructions at:

It's currently written as a module which outputs OCaml directly, and  
once I'm happy with the feature-set, I intend to port it to use camlp4  
so that schemas can be declared directly without the need to  
regenerate a separate ML file.

You can view an example schema at:
- declares the fields
- uses it
- my_db.* are the generated files.
- the tests/ directory has more advanced usage, such as foreign keys  
and so on.