query with one attribute of table to list

183 views
Skip to first unread message

lestat

unread,
Mar 27, 2012, 11:27:04 AM3/27/12
to sqlal...@googlegroups.com
If I want get list of id's of table I can get it with

z = db.session.query(MyTable.id).all()

but it return list like [(7), (13)],
but I want like [7, 13].

Now I do it with [x[0] for x in z]

Maybe is exists better solution?

Thanks




lestat

unread,
Apr 12, 2012, 4:03:27 AM4/12/12
to sqlal...@googlegroups.com
Maybe in sqlalchemy add attribute like "flat=True" that return list with values (instead of tuples with values) ?


вторник, 27 марта 2012 г., 19:27:04 UTC+4 пользователь lestat написал:
Reply all
Reply to author
Forward
0 new messages