sequelize-typescript icon indicating copy to clipboard operation
sequelize-typescript copied to clipboard

I can't replace certain columns

Open Gustazx opened this issue 11 months ago • 1 comments

In sequelize raw queries, if i want to do a replace in certain columns that no needs quotes, i can't disable this quotes to use in my context

Example:

const query = "SELECT * FROM users u ORDER BY :field :order"


const items = await this.sequelize.query(query, {
    replacements: {
    field: "u.name",
    order: "ASC",
    }
});

the query would be SELECT * FROM users u ORDER BY N'u.name' N'ASC' causing a syntax error in database

Is there a method that i can disable this ?

Gustazx avatar Jan 30 '25 12:01 Gustazx

I need to concatenate to solve this problem; I believe a method for this would be convenient.

Joaopaulovendramini avatar Jan 30 '25 12:01 Joaopaulovendramini