Mengu, one made one small change to your code for backwards compatibility (putting the value back into _extra). Other than that, I added a with_alias method to Expression so you can do:
rows = db(db.stuff.id>0).select(db.stuff.value.count().with_alias('mycount')) print rows.first().mycount I will make patches for sql.py and dal.py that include your code unless you have already started. On Mar 11, 10:16 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > as is a reserved keyword in Python. We need to use with_alias instead > (we do it for Table already). I'd take a patch but this needs to be > tested, I am not sure what it may break. Also we need to patch both > sql.py and dal.py and they are different. > > Massimo > > On Mar 11, 10:08 am, "mr.freeze" <nat...@freezable.com> wrote: > > > I like this too. Could we go one step further and add an 'as' to > > Field class? > > > db.table.field.as('t') > > > On Mar 11, 9:35 am, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > > I like it, much cleaner, and what I would expect. > > > > -Thadeus > > > > On Thu, Mar 11, 2010 at 9:18 AM, Mengu <whalb...@gmail.com> wrote: > > > > Anyone has any other way for writing that query? > > > > > Massimo, wouldn't you accept this as a patch? > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "web2py-users" group. > > > > To post to this group, send email to web...@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > web2py+unsubscr...@googlegroups.com. > > > > For more options, visit this group > > > > athttp://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.