DataMapper
{{Short description|Software library}}
DataMapper is an object-relational mapper library written in Ruby that follows the active record pattern even though the name implies it follows the data mapper pattern. While DataMapper 1 may not have achieved total decoupling between object and database suggested by the data mapper pattern, it appears DataMapper 2 intended to change this (a la Virtus, a library adapted from DataMapper).{{cite web|url=https://github.com/datamapper/dm-core/wiki/Roadmap|title=datamapper wiki: Roadmap|publisher=GitHub}} The DataMapper 2 project was renamed before launch and was released as Ruby Object Mapper (ROM) in August 2013.{{cite web|url=https://groups.google.com/forum/#!topic/datamapper/ng-e4kYaCck|title=Where is DataMapper 2?|publisher=Google Groups}}
Some features of DataMapper:{{Cite web |url=http://datamapper.org/why |title=DataMapper - Why DataMapper? |access-date=2010-10-12 |archive-date=2010-10-08 |archive-url=https://web.archive.org/web/20101008025706/http://datamapper.org/why |url-status=dead }}
- 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.{{cite book
| last = Fowler | first = Martin
|author2=David Rice |author3=Matthew Foemmel |author4=Edward Hieatt |author5=Robert Mee |author6=Randy Stafford
| title = Patterns of Enterprise Application Architecture
| publisher = Addison-Wesley
|date=November 2002
| isbn = 0-321-12742-0
}} As a result, DataMapper adapters have been built for other non-SQL databases, such as CouchDB,{{Cite web |url=https://github.com/kabari/dm-couchdb-adapter/tree/master |title=Kabari's dm-couchdb-adapter at master - GitHub |website=GitHub |access-date=2016-01-02 |archive-url=https://web.archive.org/web/20090827004529/http://github.com/kabari/dm-couchdb-adapter/tree/master |archive-date=2009-08-27 |url-status=dead}} Apache Solr,{{Cite web|url=https://github.com/lritter/dm-solr-adapter/tree/master|title=Lritter/Dm-solr-adapter|website=GitHub|date=13 August 2019}} and webservices such as Salesforce.com.{{Cite web|url=https://github.com/halorgium/dm-salesforce/tree/master|title=Dm-salesforce|website=GitHub|date=22 February 2020}}
References
{{reflist}}
External links
- [http://datamapper.org/ DataMapper homepage]
Category:Object–relational mapping
{{database-software-stub}}