Sequelize: Using Multiple Databases : <p>Do I need to create multiple instances of Sequelize if I want to use two databases? That is, two databases on the same machine.</p>

<p>If not, what's the proper way to do this? It seems like overkill to have to connect twice to use two databases, to me.</p>

<p>So for example, I have different databases for different functions, for example, let's say I have customer data in one database, and statistical data in another. </p>

<p>So in MySQL:</p>

<pre><code>MySQL [customers]&gt; show databases;
+--------------------+
| Database           |
+--------------------+
| customers          |
| stats              |
+--------------------+
</code></pre>

<p>And I have this to connect with sequelize</p>

<pre><code>// Create a connection....
var Sequelize = require('sequelize');
var sequelize = new Sequelize('customers', 'my_user', 'some_password', {
    host: 'localhost',
    dialect: 'mysql',

    pool: {
        max: 5,
        min: 0,
        idle: 10000
    },
    logging: function(output) {
        if (opts.log_queries) {
            log.it("sequelize_log",{log: output});
        }
    }

});

// Authenticate it.
sequelize.authenticate().nodeify(function(err) {

    // Do stuff....

});
</code></pre>

<p>I tried to "trick" it by in a definition of a model using dot notation</p>

<pre><code>var InterestingStatistics = sequelize.define('stats.interesting_statistics', { /* ... */ });
</code></pre>

<p>But that creates the table <code>customers.stats.interesting_statistics</code>. I need to use an existing table in the stats database.</p>

<p>What's the proper way to achieve this? Thanks.</p>
