John Honai
John Honai

Reputation: 69

How to get all the values in a column sequentially using SqlAlchemy?

I have a Profile named School

Table is :

   id[pk]     name    division
   ------     ----    --------
 1  100       John      2
 2  102       Maria     5
 3  108       Hooper    4

PK Column Type: 'Numeric'.

How do get all the id values sequentially from the very first to the last using python?

Upvotes: 2

Views: 64

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83808

Here:

for row in dbsession.query(School.id).order_by(School.id):
    print(row[0])

Upvotes: 2

Related Questions