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:
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With