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

attributeSelector arg for getQueryInterface().rawSelect() does not process an array of strings #16424

Closed
joseph-hailu-dd opened this issue Aug 26, 2023 · 1 comment
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet

Comments

@joseph-hailu-dd
Copy link

I took a peak at the source for v6 and the typedef for the attributeSelector is a string or an array of strings

  /**
   * Selects raw without parsing the string into an object
   */
  public rawSelect(
    tableName: TableName,
    options: QueryOptionsWithWhere,
    attributeSelector: string | string[], // i am passing array of strings
    model?: ModelType
  ): Promise<string[]>;

but it seems the method does not account for an array of strings being passed for attributeSelector

const result = data ? data[attributeSelector] : null;

this means the query below returns undefined

const r = await sequelize
        .getQueryInterface()
        .rawSelect(
           'tableName',
           { plain: true, raw: true, where: { [primaryKeyColumn]: id } },
           [ "id", "col1", "col2"],
        );
 console.log({ r });

Originally posted by @joseph-hailu-dd in #16112 (comment)

@github-actions github-actions bot added the pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet label Aug 26, 2023
@ephys
Copy link
Member

ephys commented Mar 26, 2024

QueryInterface.rawSelect is not a public API yet, which is why it has strange behaviors. We're working on making all available methods of that class public in v7, but this one isn't one of them yet

@ephys ephys closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet
Projects
None yet
Development

No branches or pull requests

2 participants