Node sequelize.io

hello -

i am a newbie evaluating cockroachdb as a replacement for MariaDB.

i have been using node sequelize with postgresql and Mariadb for some time and find sequelize to be a great ORM. its really nice to be able to have a table model and structure queries using sequelize.

however when i try to use sequelize with cockroachdb, i ran into serious issues. The sequelize people sound pessimistic that sequelize will ever be compatible with cockroach.

here is their last response:

These queries are executed when we connect to new connection through our own connection pool, to set proper timezone and retrieve the proper OIDs. There is no option to turn them off and they are vital so we can’t allow that either.

This is now CockroachDB’s compatibility issue which they have to solve. I think you should switch to Postgres, what extra features CockroachDB offers?

yes there is a bit of bias here.

does anybody have any experience using sequelize.io, or is there a better node-ORM for cockroach-node?

Hi Mark,

Over the past few months, we’ve been working towards adding support for a number of ORMs. Most of these ORMs provide a dialect abstraction to allow them to work with multiple SQL backends, and Sequelize is no different (https://github.com/sequelize/sequelize/tree/master/lib/dialects). Our general approach has been to attempt to support the Postgres dialect for these ORMs because we already support the Postgres wire protocol and have based most of our SQL design decisions off of Postgres. In some cases, this has required only a few tweaks on our end. In other cases, it has required a lot of work.

When we looked into Sequelize, we found that the Postgres dialect depended on support for stored procedures (https://github.com/sequelize/sequelize/blob/70e053cbb8e66ef6c21091cc1b3d8ab46ae1325e/lib/dialects/postgres/query-generator.js#L271). Because stored procedures are not on our immediate roadmap, supporting the dialect won’t be a quick fix. Instead, it will probably be easier to adapt the Postgres and SQLite dialects to a new CockroachDB dialect. This is something we plan to look into soon, once we get Hibernate working. That said if you wanted to experiment with this approach, we’d be more than happy to help you along the way.

hmmm well at least you didnt say something mean about me… :slight_smile:

i am wondering now if it would be easier to create a new sequelize dialect specifically for cockroach?

or better yet, do you have a name of a better ORM that might be available sometime soon?