You can try this and see what you can do with that : db(db.table).select(db.table.id).as_list()
By selecting db.table.id you will prevent the overhead of web2py compute=, represent=, etc. Richard On Tue, Feb 19, 2013 at 4:26 PM, <[email protected]> wrote: > If I select all items in a database: > > rows = db(db.table).select() > > I can get the ids by doing something like: > > ids = [] > for row in rows: > ids.append(row.id) > > However, is there a better way to get the ids straight from the rows > variable (without executing raw sql)? I feel like I'm iterating through the > entire list of items twice by doing this. > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

