Jump to content

DataMapper

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Shamatt (talk | contribs) at 20:45, 13 February 2013 (Corrected capitalizations and removed unfounded connection with Merb. This article needs much more help than I can give it right now.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

DataMapper is an object-relational mapper library written in Ruby that follows the data mapper pattern. It was developed to address perceived shortcomings in Ruby on Rails' ActiveRecord library.

Some features of DataMapper:[1]

  • 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's enterprise pattern.[2] As a result, DataMapper adapters have been built for other non-SQL databases, such as CouchDB,[3] Apache Solr,[4] and webservices such as Salesforce.[5]

References

  1. ^ http://datamapper.org/why
  2. ^ Fowler, Martin (2002). Patterns of Enterprise Application Architecture. Addison-Wesley. ISBN 0-321-12742-0. {{cite book}}: Unknown parameter |coauthors= ignored (|author= suggested) (help); Unknown parameter |month= ignored (help)
  3. ^ http://github.com/kabari/dm-couchdb-adapter/tree/master
  4. ^ http://github.com/lritter/dm-solr-adapter/tree/master
  5. ^ http://github.com/halorgium/dm-salesforce/tree/master