What is ORM (Object-Relational Mapping)?
Turkish: ORM
ORM maps database tables as objects, allowing database operations without writing raw SQL through library abstractions.
What Is ORM?
ORM (Object-Relational Mapping) maps relational database tables to classes, models, or objects in application code. Instead of writing SQL directly against a users table, a developer might call methods such as User.findMany() or user.save().
An ORM does not remove the database; it abstracts SQL generation. Developers still need to understand which queries are produced, how indexes are used, and where transaction boundaries are.
What an ORM Provides
- Model definitions: Representing tables and columns in code
- Query builder: Writing filters, sorting, and relationship queries through APIs
- Relationship handling: Modeling one-to-many and many-to-many associations
- Migration support: Versioning schema changes
- Type safety: Editor-level checks for model fields in some tools
Prisma, TypeORM, Sequelize, Django ORM, SQLAlchemy, Entity Framework, and Hibernate are common examples. Each comes with different language, ecosystem, and performance tradeoffs.
Business Use
ORMs speed up CRUD-heavy business applications and make model rules visible in code. Admin panels, SaaS products, CRM modules, and e-commerce backends often benefit from this approach.
Risks include N+1 queries, unnecessary eager loading, slow complex reports, and hiding database-specific capabilities. In performance-sensitive areas, generated queries should be inspected; direct SQL or PostgreSQL features may be the better tool.
Related Terms
Drizzle ORM is a lightweight TypeScript ORM for managing database schemas and SQL queries with compile-time type safety.
Database MigrationDatabase migration applies table, column, index, and data transformation changes through versioned files in a controlled way.
ORM MigrationORM migration is the practice of managing database schema changes through code files using ORM tools like Prisma or Drizzle.
PostgreSQLPostgreSQL is an open-source ACID-compliant relational database that combines SQL, JSON support, indexing, and extensibility.
Prisma ORMPrisma is a modern ORM for TypeScript and Node.js that manages database schemas, migrations, and type-safe queries in one workflow.
SQL (Structured Query Language)SQL is the standard language for querying, changing, and reporting on structured data stored in relational database tables.
Stored ProcedureA stored procedure is a named SQL block saved in the database and called with parameters to run repeatable data operations.