views:

26

answers:

1

Hello, I have simple question regarding SQLAlchemy, is it possible to get the rows from the result as scalars instead of tuples? In other words I want an equivalent to:

[i[0] for i in self.archive.query(IRTerm.term).distinct()]

Thank you

+2  A: 

No built in way in SQLAlchemy, but with python it isn't too hard. The example you gave works fine. You can also do map(itemgetter(0), query) or for value, in query:.

Ants Aasma
Thank you, I just asked if there is some builtin way. So I'll continue using the solution that I mentioned.
honzas