nicky2291 Ответов: 1

Как удалить двойные кавычки из сгенерированного запроса sequelize


Is it possible to remove double quotes from generated query in Sequelize from ranking column?

db.leaderboard.findAll({
            attributes: ['user_id', ['amt_agg', 'amount'], ['dist_agg', 'distance'],
            [sequelize.col('row_number() OVER (ORDER BY (dist_agg) DESC)'),'ranking' ]]
        })

Generated output of above code:-

SELECT "user_id","amt_agg" AS "amount","dist_agg" AS "distance", "row_number() OVER (ORDER BY (dist_agg) DESC)" AS "ranking" FROM "leaderboard" AS "leaderboard";

What I have tried:

Everything is working fine if I remove double quotes(") from ranking column in generated output.

1 Ответов

Рейтинг:
0

Member 13804468

Используйте модель.ранжирование

Модель-это имя модели, например
var Model = models.size