I have a User
model where users can have the same name. I want to get the email addresses of all the users with a given name. However, I have to do result[0].email
on the result of the query to get just the email for a row. I could do this with a for loop, but is there a way to just get the list of one field without having to do this every time?
my_result = db.session.query(my_table).filter_by(name=name)
emails = []
for r in my_result:
emails.append(r.email)