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

Didn't find docs about queryInterface.sequelize.query API. #11860

Closed
2 of 7 tasks
mrdulin opened this issue Jan 23, 2020 · 2 comments · Fixed by #13914
Closed
2 of 7 tasks

Didn't find docs about queryInterface.sequelize.query API. #11860

mrdulin opened this issue Jan 23, 2020 · 2 comments · Fixed by #13914
Assignees
Labels
dependency For issues and PRs. Things that are related to one or more dependencies. status: understood For issues. Applied when the issue is understood / reproducible. type: docs For issues and PRs. Things related to documentation, such as changes in the manuals / API reference.

Comments

@mrdulin
Copy link

mrdulin commented Jan 23, 2020

Issue Description

I generate the seed file like this:

'use strict';

const faker = require('faker');

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.bulkInsert('Language', [
      { ID: 1, Name: faker.random.locale(), Last_Update: Sequelize.fn('NOW') },
      { ID: 2, Name: faker.random.locale(), Last_Update: Sequelize.fn('NOW') },
      { ID: 3, Name: faker.random.locale(), Last_Update: Sequelize.fn('NOW') },
    ]);

    const languages = await queryInterface.sequelize.query(`select * from "Language";`);
    console.log(languages);
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.bulkDelete('Language', null, {});
  },
};

I say people use queryInterface.sequelize.query to execute the raw SQL query.
But didn't find the explanation about this on the documentation. Actually, I didn't find this API.

What was unclear/insufficient/not covered in the documentation

I read this doc: https://sequelize.org/master/class/lib/query-interface.js~QueryInterface.html

But didn't find any information about queryInterface.sequelize.query.

If possible: Provide some suggestion on how we can enhance the docs

Add docs for queryInterface.sequelize.query API.

Additional context

I found this API according to this post: https://stackoverflow.com/a/48753999/6463558

"sequelize": "^5.21.3",
"sequelize-cli": "^5.5.1"

Issue Template Checklist

Is this issue dialect-specific?

  • No. This issue is relevant to Sequelize as a whole.
  • Yes. This issue only applies to the following dialect(s): XXX, YYY, ZZZ
  • I don't know.

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I don't know how to start, I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
@mrdulin mrdulin added the type: docs For issues and PRs. Things related to documentation, such as changes in the manuals / API reference. label Jan 23, 2020
@papb
Copy link
Member

papb commented Jan 23, 2020

The fact that queryInterface has a sequelize field seems undocumented indeed; I am not sure if this is intentional or not. This sequelize field is simply a normal Sequelize instance, so the API you're looking for is here.

Thanks for the report.

@papb papb added dependency For issues and PRs. Things that are related to one or more dependencies. status: understood For issues. Applied when the issue is understood / reproducible. labels Jan 23, 2020
@papb papb self-assigned this Jan 23, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2021

This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency For issues and PRs. Things that are related to one or more dependencies. status: understood For issues. Applied when the issue is understood / reproducible. type: docs For issues and PRs. Things related to documentation, such as changes in the manuals / API reference.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants