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
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
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:
.