0% found this document useful (0 votes)
612 views7 pages

Sequelize: ORM For Node - Js

Sequelize is an ORM for Node.js that provides a programmatic way to connect code to a database and manipulate data. It supports multiple databases including Postgres, MySQL, and SQLite. Sequelize offers features like promises, database migrations, associations, transactions, and raw queries. It works by installing Sequelize, connecting to a database, creating models, syncing models to the database, and performing CRUD operations. Sequelize is a stable, mature ORM with rich documentation and is easy to test.

Uploaded by

minal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
612 views7 pages

Sequelize: ORM For Node - Js

Sequelize is an ORM for Node.js that provides a programmatic way to connect code to a database and manipulate data. It supports multiple databases including Postgres, MySQL, and SQLite. Sequelize offers features like promises, database migrations, associations, transactions, and raw queries. It works by installing Sequelize, connecting to a database, creating models, syncing models to the database, and performing CRUD operations. Sequelize is a stable, mature ORM with rich documentation and is easy to test.

Uploaded by

minal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Sequelize

ORM for Node.js


What is ORM
• Programmatic way to connect our code to DB and manipulate data
• Developer - focus on business logic
• When an object is read, created, updated, or deleted, the ORM constructs and executes
a database query under the hood
• Comes with advanced features – connection pooling, transaction support, migrations etc
• Work with multiple DBs – postgres, mysql, sqllight

Cons-
• Overhead of learning
• Initial configuration takes time
• Developer wont be knowing what is happening under the hood
Why Sequelize ?
• Different ORMs available – TypeORM, Prisma, Sequelize, BookShelf
• Prisma –
• Auto-generated query builder ,
• Graphql support with all queries for CRUD operations
• Support less DBs compared to other ORMs.
• Not matured compared to other ORMs, some features are in experimental
• Some datatypes like json, array, timestampZ are not supported
• TypeORM –
• traditional ORM
• Good support for Typescript and latest JS features.
What Sequelize provide
• Promise based
• Support for multiple DBs
• DB sync
• DB migrations
• Model hooks
• Associations – belongsTo , hasMany, hasOne, belongsToMany
• Transaction support
• Raw queries
• Easy to test
• Rich Documentation
• Stable
How Sequelize works
• Install Sequelize
• Connect to DB
• Create Model for mapping
• Mapping Model to DB- sync (Model First Approach)
• CRUD operations.
More Details -
https://sequelize.org/v5/index.html
DEMO
Thanks

You might also like