Skip to content

Instantly share code, notes, and snippets.

@musubu
Created March 22, 2012 06:59
Show Gist options
  • Save musubu/2156761 to your computer and use it in GitHub Desktop.
Save musubu/2156761 to your computer and use it in GitHub Desktop.
use raw query with sequelize
var Sequelize = require('Sequelize');
var sequelize = new Sequelize('dbname', 'username', 'password');
sequelize.connectorManager.client.query('select * from tablename', function(err, results) {
if (!err) {
console.log(results);
// you'll get an array of objects
// [{id: 1, ...}, {id: 2, ...}]
} else {
console.log(err);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment