How can I see the SQL generated by Sequelize.js?

You can pass a logging option when initializing sequelize, which can either be a function or console.log

var sequelize = new Sequelize('database', 'username', 'password', {
    logging: console.log
    logging: function (str) {
        // do your own logging
    }
});

You can also pass a logging option to .sync if you only want to view the table creation queries

sequelize.sync({ logging: console.log })

Leave a Comment

tech