Datamapper
Encyclopedia
Datamapper is an object-relational mapper
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...

 library written in Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

 and commonly used with Merb
Merb
Merb, short for "Mongrel+Erb", is a model–view–controller web framework written in Ruby. Merb adopts an approach that focuses on essential core functionality, leaving most functionality to plugins. Merb was merged into Rails web framework on December 23, 2008 as part of the Ruby on Rails 3.0...

. It was developed to address perceived shortcomings in Ruby on Rails
Ruby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...

' ActiveRecord library.

Some features of Datamapper:
  • eager loading of child associations to avoid (N+1) queries
  • lazy loading of select properties, e.g., larger fields
  • query chaining, and not evaluating the query until absolutely necessary (using a lazy array implementation)
  • an API not too heavily oriented to SQL databases


Datamapper was designed to be a more abstract ORM, not strictly SQL, based on Martin Fowler
Martin Fowler
-Online presentations:* at RailsConf 2006* at JAOO 2006* at QCon London 2007 * at QCon London 2008 * at ThoughtWorks Quarterly Technology Briefing, October 2008...

's enterprise pattern. As a result, people have built Datamapper adapters for other non-SQL databases, such as CouchDB
CouchDB
Apache CouchDB, commonly referred to as CouchDB, is an open source document-oriented database written mostly in the Erlang programming language. It is part of the NoSQL group of data stores and is designed for local replication and to scale horizontally across a wide range of devices...

, Apache Solr, and webservices such as Salesforce.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK