Re: [sqlalchemy] Re: How to get specific attribute from last row?

2015-09-24 Thread David Allouche
> On 23 Sep 2015, at 20:37, Sebastian M Cheung > wrote: > > posts = User.query.all() > row = posts.select().execute().fetchone() > print row[-1] > return row.activation_code > > doesnt work Why are you doing this? Instead of, for example: posts =

[sqlalchemy] Re: How to get specific attribute from last row?

2015-09-24 Thread Sebastian M Cheung
class User(db.Model): id = db.Column(db.Integer, primary_key=True) mobile = db.Column(db.String(20), unique=False, nullable=False, info={'validators': InputRequired()}) activation_code = db.Column(db.String(6), unique=False, nullable=False, info={'validators': InputRequired()})

[sqlalchemy] Re: How to get specific attribute from last row?

2015-09-23 Thread Jonathan Vanasco
You should share your SqlAlchemy model along with an executable script that illustrates the query and others can comment-on or fix. You are simply showing a mixture of raw data and random results that are without any context. -- You received this message because you are subscribed to the

[sqlalchemy] Re: How to get specific attribute from last row?

2015-09-23 Thread Sebastian M Cheung
posts = User.query.all() row = posts.select().execute().fetchone() print row[-1] return row.activation_code doesnt work -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an

[sqlalchemy] Re: How to get specific attribute from last row?

2015-09-23 Thread Sebastian M Cheung
for v in posts: for column, value in v.items(): print '{0}: {1}'.format(column, value) Also doesn't work -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an