Good afternoon everyone. I am developing a node.js/express system using sequelize.js (postgresql).
My problem is: I need to store the raw queries generated by sequelize in a log history, but I can't find a function that returns the generated query. Does anyone know if sequelize provides a function that returns the generated SQL query, or if there's any other way to achieve this?
Your best bet is to use Sequelize's built-in logging functionality.
var sequelize = new Sequelize('db', 'username', 'pwd', {
// you can either write to console
logging: console.log
// or write your own custom logging function
logging: function (str) {
// do stuff with the sql str
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With