DataMapper vs Sequel

From WikiVS, the open comparison website
Jump to: navigation, search

DataMapper and Sequel are Ruby libraries that provide object models on top of relational databases. While DataMapper is meant to use any data store back-end, Sequel focuses only on relational databases, specifically, SQL databases.


DataMapper starts with the object model and tries to abstract away the way the objects are stored. Hence, DataMapper maps objects onto its data store back-end. Sequel Models work the other way, starting with the database, and mapping database rows onto objects.


DataMapper and Sequel provide an impressive array of features that are found in no other ORMs.

Query Interface[edit]

Both DataMapper and Sequel have special DSL constructs that provide easy ways to fetch data using Ruby datatypes.


DataMapper supports most major SQL databases. However, it is not limited to databases only. DataMapper can map object models to YAML and CSV, as well as object databases.

Sequel supports all major SQL databases.

Model Library[edit]

Sequel is divided into two parts, the core library and the model library. The core library allows users to connect, read, and manipulated databases directly, while the model library provides an ActiveRecord-like interface to create object models on top of the core library.

DataMapper has only one library that does all the database manipulation.

Lazy loading[edit]

DataMapper has direct support for lazy loading.

Eager graphs[edit]

Both DataMapper and Sequel have support for eager graphs. DataMapper's eager loading is implicit, while Sequel's eager loading is explicit.