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.

All I can think of is something like:

        temp = []

        for thing in db(db.mytable).select(db.mytable.myfield):
                temp.append(thing)

        return temp

I was hoping for something like:

        return db(db.mytable).select(db.mytable.myfield).as_list()

Or something like that.

As an aside, I have a python dbi that has four central ways to get
data back.  I call them:

atom()          scalar as in    'select first from person where id = 1'
row()           dict as in      'select * from person' where id = 1'
column()        list as in      'select first from person'
world()         list of dict:   'select * from person'

They end up being uite convenient and result in concise syntax.

Thanks,

Tobiah

--



Reply via email to