Databases and storage · Concept

ORM

A library that lets code work with database rows as ordinary objects in its own language, instead of writing SQL strings by hand.

Talking to a database · updated

How it works

An ORM maps tables to classes or types, so user.posts can fetch a user's posts and a save call writes changes back. Most also manage migrations and give typed results. Examples: Prisma and Drizzle in TypeScript, SQLAlchemy and Django's ORM in Python, Hibernate in Java, Room on Android.

The convenience has a cost: generated queries can be slow or wasteful (the classic N+1 problem, one query per item in a list), and complex reports are often easier in plain SQL. Query builders sit in between, keeping the shape of SQL with type safety.

More in Databases and storage

Talking to a database

All 25 Databases and storage terms

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.