1. append_column() only raises that error if the Column() you're sticking
there was already associated with some other table or selectable object.
2. you need ALTER TABLE. you can of course just say engine.execute("ALTER
TABLE <rest of statement>"). For more options, there is an FAQ entry
here:
http://www.sqlalchemy.org/trac/wiki/FAQ#DoesSQLAlchemysupportALTERTABLECREATEVIEWCREATETRIGGERSchemaUpgradeFunctionality
Nelson wrote:
>
> I have virtually the same question. To put it another way I have an
> ORM mapped Table() in my Python code. There is a Column() in that
> table that is not yet in my Postgres database. How do I get that Column
> () into the database?
>
> I have tried table.append_column(col) but it's telling me "this Column
> already has a table!"
>
> I'm using 0.5.3 and am about to go to 0.5.5
>
> Thanks in advance for any help.
> Nelson
>
> On Aug 11, 8:28 am, tom <[email protected]> wrote:
>> Hello,
>>
>> my question is quite a basic one, but I couldn't find an answer, maybe
>> because it's too basic.
>>
>> I have a table "User" and want to add a new Column('donated',
>> Boolean). Then I initialize the database with metadata.create_all
>> (self.database_engine) but in phpPgAdmin there are no changes. Also,
>> if I modify an existing column, eg. from Column('subject', String
>> (128)) to Column('subject', String(128), default='(no subject)'), and
>> then do create_all, nothing changes.
>>
>> Is create_all the wrong thing to do there, or where am I going wrong?
>>
>> Regards,
>> Tom
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---