Re: [web2py] Re: Get result set back as list?

2012-08-11 Thread Toby Shepard
On 8/10/2012 3:58 PM, Vasile Ermicioi wrote: for me that works alist = db(db.auth_user).select().as_list() How funny. I was just making up the name as_list(). Great minds think alike I guess. I was looking for a flat list of field values, but the list comprehension solution is ok I guess.

Re: [web2py] Re: Get result set back as list?

2012-08-10 Thread Anthony
On Friday, August 10, 2012 6:58:08 PM UTC-4, Vasile Ermicioi wrote: > > for me that works > > alist = db(db.auth_user).select().as_list() > That returns a list of dictionaries, like [{'myfield': 'value 1'}, {'myfield': 'value 2}]. I assumed he was looking for a list of the individual field value

[web2py] Re: Get result set back as list?

2012-08-10 Thread Cliff Kachinske
I use Anthony's method because it returns a true list. as_list() returns a list of dictionaries, and you still have to iterate over the dictionaries in the list to extract the values. On Friday, August 10, 2012 4:34:01 PM UTC-4, Toby Shepard wrote: > > > I'm in a situation where I just want a si

Re: [web2py] Re: Get result set back as list?

2012-08-10 Thread Derek
works for me too. db(db.customers).select(db.customers.name).as_list() On Friday, August 10, 2012 3:58:08 PM UTC-7, Vasile Ermicioi wrote: > > for me that works > > alist = db(db.auth_user).select().as_list() > --

Re: [web2py] Re: Get result set back as list?

2012-08-10 Thread Vasile Ermicioi
for me that works alist = db(db.auth_user).select().as_list() --

[web2py] Re: Get result set back as list?

2012-08-10 Thread Anthony
mylist = [r.myfield for r in db().select(db.mytable.myfield)] Anthony On Friday, August 10, 2012 4:34:01 PM UTC-4, Toby Shepard wrote: > > > I'm in a situation where I just want a single column back from > a table. I'd like it as a list so I could just pass it on > to the next function. > > A