# ORM

*noun*

say it: **“OH-AR-EM”** **/ˌoʊ ɑr ˈɛm/**

Short for object-relational mapper: a library that describes database tables as classes in your code, writes the SQL for you, and hands back objects instead of rows.

## What is an **ORM**?

An **ORM** (object-relational mapper, read "O R M") is a library that describes each table as a class in your code,
writes the SQL for you, and hands back objects instead of rows. It saves typing, but hides the SQL and is one more
library to learn. SQLAlchemy (Python) and Entity Framework (C#) are ORMs.

```python
# Without an ORM: you write the SQL and get rows back
rows = conn.execute("SELECT * FROM workouts WHERE member = ?", ("Luis",)).fetchall()

# With an ORM (SQLAlchemy): you ask in Python and get Workout objects back
workouts = session.scalars(select(Workout).where(Workout.member == "Luis")).all()
```

## In a sentence

- “The team's **ORM** wrote the SELECT for them and handed back Workout objects.”
- “Hand-written SQL keeps every query in sight; an **ORM** saves typing but hides it.”

Level: Journeyman · [More Database terms at this level](https://www.ask-codey.com/glossary?category=database&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/orm-database
