Use different mysql user in Sequelizejs

Is it possible with SequelizeJs to define model for mulitple connections. I mean I want to use several MySQL user to query my database.

Here is an example of what I want. Let's start with the connection definition

var user1 = new Sequelize('database', 'user1', 'pwd1', {
    host: "my.server.tld",
    port: 12345
})

var user2 = new Sequelize('database', 'user2', 'pwd2', {
    host: "my.server.tld",
    port: 12345
})

But now if I have a dynamic number of user I can store each connection in an array

var user = [];
for(var myUser in myUsers) {
    user.push(
        new Sequelize('database', myUser.username, myUser.pwd, {
          host: "my.server.tld",
          port: 12345
        })
    )
}

Then what, if I want to declare my models I have to make a loop on each connection to declare my models for each connection ??

There is no way to declare my model not linked to my connection, then specify which connection to use when I query my database ?

There is no way to tell sequelize at the time you are querying which connection you should use. However, you don't have to define the model for each connection, you can just import it for each connection

// models/user.js
module.exports = function (sequelize, DataTypes) {
  return sequelize.define ...
}

And then for each connection in the user array you can do connection.import('./models/user.js') and either store the version of the model for that specific connection somewhere, or use connection.model(name)to fetch the model for that specific connection each time you need it. https://github.com/sequelize/sequelize/wiki/API-Reference-Sequelize#model

in my understood, this help you, maybe read-replication