I do not think this qualifies for addition but it is useful. I would have done:
rows = db().select(db.table.ALL) db.table.fieldtodelete.writable=False table = SQLTABLE(rows) or rows = db().select(*[field for field in db.table if not field.name=='fieldtodelete']) table = SQLTABLE(rows) On Aug 3, 3:17 pm, Richard Vézina <ml.richard.vez...@gmail.com> wrote: > Don't know if my "delete column function" could be part of web2py core > functions but here it is : > > def __del_sqltable_column(sqltable, column_name): > """ > For deleting a given column in an instance of web2py SQLTABLE class. > Pass the SQLTABLE object and the column name to delete. > Ex.: table1 = SQLTABLE(rows) contains id column and we want to delete > it. > So we call __del_sqltable_column(tabel1, 'table.id') or > __del_sqltable_column(request.args(0), db[request.args(0)].id) > When the column name is changed with represent the representation should > be > passed as column name. > """ > import re > regex_colum_name = re.compile(str(TH(column_name))) > for i in range(0, len(sqltable[0][0])): > if regex_colum_name.match(str(sqltable[0][0][i])): > for r in range(0, len(sqltable[1])): > del(sqltable[1][r][i]) > del(sqltable[0][0][i]) > return sqltable > return sqltable > > It could be my first contribution to web2py ;-) > > Richard > > On Wed, Aug 3, 2011 at 4:08 PM, Richard Vézina > <ml.richard.vez...@gmail.com>wrote: > > > > > > > > > Yes... I use pgAdmin for the other things, I didn't fix my choice on a > > commercial database manager... > > > ;-) > > > Richard > > > On Wed, Aug 3, 2011 at 4:04 PM, Anthony <abasta...@gmail.com> wrote: > > >> I think he wants to delete columns from a SQLTABLE, not a db table. > > >> On Wednesday, August 3, 2011 4:01:09 PM UTC-4, pbreit wrote: > > >>> That's how I delete columns.