question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sequelize.query('string', {raw: true}) not raw

See original GitHub issue
const 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:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jiangyan33commented, Mar 1, 2019

mysql is ok

0reactions
stale[bot]commented, May 30, 2019

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 🙂

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found