# Object-Relational Mapping (ORM)

> Code that lets you use rows as objects in your own language. You write no SQL.

**Field:** Software Development  
**Category:** Databases  
**Also known as:** ORM, Object Relational Mapper

## Think of it like

Think of it like a helper who speaks two tongues. You talk in yours, and it talks to the database in its own.

## Definition

An ORM is a library that lets you work with rows as objects in your own code. Instead of writing SQL, you write code like user.save() or Order.find(5). The ORM turns that into SQL, runs it and turns the rows back into objects. It saves typing and catches some mistakes early. But it can hide slow queries, so it helps to know the SQL it writes.

## Example

Emma's Python app uses an ORM. She writes Customer(name="Lucy") and the ORM sends the INSERT for her.

## Why it matters

Most web frameworks come with an ORM. It is how many coders talk to a database each day.

## Common mistake

Never looking at the SQL the ORM sends. A loop that looks harmless can send hundreds of queries.

## Three principles

- **Rows as objects.** Use your own language, not SQL.
- **SQL written for you.** The ORM builds and runs it.
- **Check what it sends.** It can hide slow queries.

## Related terms

- [N+1 Query Problem](https://learn.benibix.com/term/development/n-plus-one-query)
- [Structured Query Language (SQL)](https://learn.benibix.com/term/development/sql)
- [Software Library](https://learn.benibix.com/term/development/library)
- [Database Migration](https://learn.benibix.com/term/development/database-migration)
- [Repository Pattern](https://learn.benibix.com/term/development/repository-pattern)

---

Source: https://learn.benibix.com/term/development/orm
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
