A
A
Alexander2018-10-23 00:31:29
Python
Alexander, 2018-10-23 00:31:29

How to get row number in Flask-sqlalchemy table?

Hello, I need help. I'm using the flask-sqlalchemy extension. Here's the link . I have a table of players in which everyone has a rating, the rating is just an integer. I found how to sort in descending order.

query = Player.query.order_by(Player.rating.desc()).all()

For example, I have a player with id=52, how can I find out what place he occupies in the sorted query?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2018-10-23
@vintello

and what prevents to count a position in query of this id?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question