sequelize.query('string', {raw: true}) not raw
See original GitHub issueconst Sequelize = require('sequelize')
const sequelize = new Sequelize(
'db',
'db',
'db',
{
dialect: 'sqlite',
storage: null,
logging: false,
operatorsAliases: Sequelize.Op
}
)
const date = {
date: {
type: Sequelize.STRING,
allowNull: false
}
}
sequelize.define('date', date, {timestamps: false})
const main = async () => {
await sequelize.sync()
const res = await sequelize.query('SELECT * FROM dates', {raw: true})
console.log(res)
// expected -> []
// actual -> [ [], Statement { sql: 'SELECT * FROM dates' } ]
}
main()
Is this a bug or do I have the syntax wrong?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Raw Queries - Sequelize
In case of false it will return all records. plain: false, // Set this to true if you don't have a model definition...
Read more >Setting all queries to raw = true sequelize - Stack Overflow
According to the doc : If you do not provide other arguments than the SQL, raw will be assumed to the true, and...
Read more >Why You Should be Cautious with Sequelize Raw Options
So, using raw options in Sequelize will return you a number with 0 or 1 for the boolean field since MySQL uses TINYINT...
Read more >How to execute/ use a raw query with Sequelize
Sequelize instance comes with the query() method which you can use to run a raw query. The syntax of the method is as...
Read more >[Solved]-Setting all queries to raw = true sequelize-sequelize.js
According to the doc : If you do not provide other arguments than the SQL, raw will be assumed to the true, and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
mysql is ok
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂