The reason for wanting to rename the column is because I am using the plugin
web2py.plugin.datatable.w2p and make the query as:
rows = db (db.accountcode.id_clientes == session.cliente_id). select
(Db.accountcode.ani) I get the title of the column and I want to show
accountcode.ani annex the title.




2010/11/11 Thadeus Burgess <thade...@thadeusb.com>

> To rename a column:
>
>
> #Let web2py use migration to create a new column
> db.define_table('table', Field('oldcolumn'), Field('newcolumn'))
>
> #Update the data, copy the old column into the new column
> db(db.table.id > 0).update(db.table.newcolumn = db.table.oldcolumn)
>
> #Save the changes
> db.commit()
>
> #Remove the old column, letting web2py migrate drop the old column
> db.define_table('table', Field('newcolumn'))
>
> --
> Thadeus
>
>
>
>
>
> On Thu, Nov 11, 2010 at 10:10 AM, mdipierro <mdipie...@cs.depaul.edu>wrote:
>
>> In web2py you cannot rename a column. Why do you want to do it?
>>
>> On Nov 11, 9:04 am, mmartinez <alexra...@gmail.com> wrote:
>> > Good afternoon, everyone.
>> >
>> > Well I need to do is to rename the name of a column
>> > web2py the sql, sql language-I would do as follows when:
>> > select animals as "Annex" from WHERE accountcode
>> > accountcode.id_clientes = session.cliente_id;
>> >
>> > and web2py do so:
>> >
>> > rows = db (db.accountcode.id_clientes == session.cliente_id). select
>> > (db.accountcode.ani
>> > as "Annex")
>> >
>> > and the error is.
>> > SyntaxError: invalid syntax
>> >
>> > If I can help as it they are grateful.
>>
>
>

Reply via email to