[sqlalchemy] Re: Adding new columns to a table

2009-08-12 Thread Nelson
Thanks! I had actually just arrived at looking at this code: class PGSchemaGenerator(compiler.SchemaGenerator): def get_column_specification(self, column, **kwargs): ...snipped... else: colspec += " " + column.type.dialect_impl (self.dialect).get_col_spec() but ha

[sqlalchemy] Re: Adding new columns to a table

2009-08-12 Thread Michael Bayer
Nelson wrote: > > Michael, > > Looking at some usage links on the Wiki, thanks to your original link, > brought up this: > > http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode > > which has this gem of informaton: > > from sqlalchemy.databases import postgres > - and - > coltypes = dict( (v

[sqlalchemy] Re: Adding new columns to a table

2009-08-12 Thread Nelson
Michael, Looking at some usage links on the Wiki, thanks to your original link, brought up this: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode which has this gem of informaton: from sqlalchemy.databases import postgres - and - coltypes = dict( (v,k) for k,v in postgres.pg2_colspecs

[sqlalchemy] Re: Adding new columns to a table

2009-08-11 Thread Nelson
Thanks. I did manage to make a Column() that was no longer associated with a table. The append_table() code ran fine then, but the database did not actually change. I bound it to the correct engine and metadata (so I think) but no luck. I also started down the ALTER TABLE path earlier, and in fa

[sqlalchemy] Re: Adding new columns to a table

2009-08-11 Thread Michael Bayer
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 "). For more options, there is an FAQ entry here: http://www.sqlal

[sqlalchemy] Re: Adding new columns to a table

2009-08-11 Thread Nelson
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 Colum