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.
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
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
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()
>
--
for me that works
alist = db(db.auth_user).select().as_list()
--
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
6 matches
Mail list logo