# Overview of ORM Database Tools

Object Relational Mapping (ORM)

### Summary

1.  Concepts of ORM
2.  Prisma ORM
3.  Type ORM
4.  Sequelize ORM
5.  Micro ORM

### References

### 1\. Concepts of ORM

Object-Relational Mapping (ORM) is a technique that lets you query and manipulates data from a database using an object-oriented paradigm. When talking about ORM, most people are referring to a library that implements the Object-Relational Mapping technique, hence the phrase “an ORM”.

An ORM library is a completely ordinary library written in your language of choice that encapsulates the code needed to manipulate the data, so you don’t use SQL anymore; you interact directly with an object in the same language you’re using.

### 2\. Prisma ORM

*   [https://www.prisma.io/](https://www.prisma.io/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174657409/q57qOA6qW.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174658818/RHE_aPVIE.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174660334/0WNE8tx_Qc.png)

### Postgres Installation with Docker

docker run --name postgresql -e POSTGRES\_PASSWORD=admin -p 5432:5432 -d postgres

### Prisma Migrate

yarn prisma migrate dev

create product

create category

create product\_category

### Prisma Studio

yarn prisma studio

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174661639/78OA1e9qV.png)

### Prisma Relations

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174662927/GmiyUWbXs.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174664103/u-WQFIPwF.png)

HTTP/1.1 200 OK

X-Powered-By: Express

Content-Type: application/json; charset=utf-8

Content-Length: 150

ETag: W/"96-UrprlteTTnqfmSPc6+2Svgk22kw"

Date: Thu, 20 Jan 2022 17:45:34 GMT

Connection: close

{

"id": "70df8552-3b15-4532-ba10-084018283e17",

"id\_product": "1d8da63e-c4dc-43e5-87b1-ddf1699dd7f1",

"id\_category": "130b29d6-563b-4a73-8c2e-fe1c737ef99c"

}

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174665458/CRdS0z1Ej.png)

### Create a Product with Category

*import* { Request, Response } *from* "express";

*import* { prismaClient } *from* "../database/prismaClient";

*export* class CreateProductWithExistCategory {

async handle(request: Request, response: Response) {

const { name, price, bar\_code, id\_category } = request.body;

const product = *await* prismaClient.productCategory.create({

data: {

product: {

create: {

bar\_code,

name,

price,

},

},

category: {

connect: {

id: id\_category,

},

},

},

});

*return* response.json(product);

}

}

### Demo Prisma Studio

[**prisma\_decode/Prisma-demo.gif at master · Data-Database/prisma\_decode**  
*Contribute to Data-Database/prisma\_decode development by creating an account on GitHub.*github.com](https://github.com/Data-Database/prisma_decode/blob/master/assets/Prisma-demo.gif "https://github.com/Data-Database/prisma_decode/blob/master/assets/Prisma-demo.gif")[](https://github.com/Data-Database/prisma_decode/blob/master/assets/Prisma-demo.gif)

### Demo Prisma Studio

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174667403/_FcY0Odfz.gif)

### Demo Prisma API

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174671585/hzPfBTy2u.gif)

### 3\. Type ORM

*   [https://typeorm.io/#/](https://typeorm.io/#/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174673393/iv0esh8Tn.jpeg)

### 4\. Sequelize ORM

*   [https://sequelize.org/](https://sequelize.org/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174674693/RAHI2dGBq.png)

### 5\. Micro ORM

[**MikroORM: TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns…**  
*TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns.*mikro-orm.io](https://mikro-orm.io/ "https://mikro-orm.io/")[](https://mikro-orm.io/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174676372/VLa8cpOi9.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662174677688/XB8sf2Pkd.png)

### References

*   [https://sequelize.org/](https://sequelize.org/)
*   [https://mikro-orm.io/](https://mikro-orm.io/)
*   [https://www.prisma.io/](https://www.prisma.io/)
*   [https://typeorm.io/](https://typeorm.io/#/)
