I have a node js project in which I want to have connection with Postgresql and MSSQL. I'm not sure if I just use DB Drivers (pg & node-mssql npm packages) or it would be better Sequelize, because I can use raw queries with Sequelize and through which only have one package for all of them.
1 Answer
Sequelize is a higher level library than pg or node-mssql. It provides an Object-Relational Mapping (ORM) interface that provides useful functions and structures for interacting with a relational database from Node. Underneath it still relies on the database driver for the database you want to use, so it will be less performant than using raw queries directly, but the tradeoff is ease of use and more guardrails to make sure things were done correctly.
If you don't need the any of the features provided by Sequelize, just query the database directly for more performance. If you need any of the abstraction or ease-of-use features of an ORM, use Sequelize.