Object Relational Mapper

An ORM is for translating SQL records into application language objects (Javascript, Python etc.).

  • an ORM doesn't prevent your need to write SQL or manage indexes

If our server has an ORM built-in (like the one Django has), it is not necessarily a bad idea to use an ORM. Consider that:


is equivalent to:

select mymodel.id, mymodel.other_field, ...
  from mymodel
 where id=1;

The SQL language abstracts away the procedural steps for querying a database, allowing one to merely define what one wants. But certain SQL queries are thousands of times slower than other logically equivalent queries. On an even higher level of abstraction, ORM systems, which isolate object-oriented code from the implementation of object persistence using a relational database, still force the programmer to think in terms of databases, tables, and native SQL queries as soon as performance of ORM-generated queries becomes a concern.