Friday, 17 March 2017

SQL queryBuilder vs ORM : squel vs (Bookshelf.js vs Sequelize.js)

I read a lot of Stackoverflow posts (like this : Using an ORM or plain SQL?).

What are the reasons for preferring one for little project ?
I'm currently using a postgres database for dev but maybe another RDMS later ....

I am in a project where I have 4 insert operations and the other 8 operations are select operations.

ORM appealed me for useful functions but not querying (seems I am in the pareto principle XD). Squel works but fails for migration into another database ..

I just hesitate which one I should prefer in my case .. Some programmers don't hesistate to call orm an antipattern (like this excellent article : http://www.yegor256.com/2014/12/01/orm-offensive-anti-pattern.html)...

My fast review (don't hesistate to correct me):

Sequelize

This thing has a big amount of useful functions but with so much open issues. For example, for postgres https://github.com/sequelize/sequelize/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20postgres .

Bookshelf.js

It has the required functions for little projects.
Strangely they have timestamp fields (createdAt, updatedAt) but it seems no way to have custom timestamps field for another need (like a date provided by another database)

Squel

This query builder make SQL queries more easy to understand (expressionBuilder,....) . The only problem : some function only exist in some flavours (way to interact with database) so not good idea for migration



via jacques y

No comments:

Post a Comment