Budding web developers learning Model-View-Controller frameworks are
taught that they should use an Object Relational Mapper (ORM) to
interface with their databases. But the “why” is often brushed aside
or omitted entirely, leaving a fledgeling programmer with burning
questions like ”What are ORMs, anyway?” and “What problems do they
solve?”
ORMs are a class of tools that facilitate interactions between a
programming language and a relational database management
system. They can range in complexity and opinionation from a simple
set of abstractions for interactions with relational databases
(SQLAlchemy Base) to fully opinionated tools for mapping database
rows to language structs (Django ORM, SQLAlchemy ORM). To get a
better understanding of how ORMs work, it’s helpful to work through
the kind of problems they can solve.