Skip to content

include dataValues can not be _sanitize #14438

Closed

Description

@brucewar

sequelize: v6.19.0

User.findAll({
  include: [{
    model: SystemUnit,
    as: 'systemUnit'
  }]
})

I have tried to debug code and found that systemUnit attributes did not execute its DataType._sanitize

Activity

  1. brucewar commented on Apr 24, 2022

    @brucewar
    Author

    model.js _setInclude childOptions maybe like this?
    image

  2. ephys commented on Apr 25, 2022

    @ephys
    Member

    I'm afraid I don't understand what the issue is

    DataType._sanitize is an internal method, it doesn't exist for every datatype

    What's the issue you're encountering? Is one a value improperly parsed from the database?

    Can you create a SSCCE as specified in our issue templates, as well as answer the questions that were asked? (see https://github.com/sequelize/sequelize/issues/new?assignees=&labels=&template=bug_report.md&title=). We won't be able to help much without that information.

  3. brucewar commented on Apr 25, 2022

    @brucewar
    Author

    For example, if I defined INTEGER in custom dialect data-types.js,and overload _sanitize.

    class INTEGER extends BaseTypes.INTEGER {
      _sanitize (value) {
        if (typeof value  === 'bigint') return parseInt(value, 10);
        return value;
      }
    }

    If include SystemUnit model has an INTEGER attribute in the above code, then sequelize would not execute into _sanitize

  4. github-actions commented on May 10, 2022

    @github-actions
    Contributor

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

  5. added
    type: bug
    and removed on May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions