Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to get executed sql query after find/ findall #5470

Closed
fabuhelow opened this issue Feb 22, 2016 · 3 comments
Closed

Need to get executed sql query after find/ findall #5470

fabuhelow opened this issue Feb 22, 2016 · 3 comments

Comments

@fabuhelow
Copy link

Hi,

I'm trying to get executed sql query after fetched the result, so is it possible to get query statement.

E.g.

Model.findAll(...).then(function(data)
{

// need to get executed sql query "select id,name from model where id = 12";

});

Any help please.

Thanks,

@janmeier
Copy link
Member

findAll({ ..., logging: function (sql) ... })

Closing this issue, since it is neither a bug report nor a feature request.

For general sequelize questions, please use Slack, StackOverflow or Google groups.

@fabuhelow
Copy link
Author

Thanks janmeier,

But i need the query inside then directive, so is it possible to pass it inside .then callback function ?

@janmeier
Copy link
Member

Have the logging function store it in a variable variable

var sql; 
findAll({ ..., logging: function (sql) ... }).then(function () {
 // do something with sql
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants