Re: [sqlalchemy] Append column

2010-03-13 Thread Michael Bayer

On Mar 12, 2010, at 10:14 AM, YAD wrote:

> Hello
> 
 from sqlalchemy import *
 engine = create_engine('mysql://root:r...@localhost/sqlalchemy')
 meta = MetaData(engine)
 tb = Table('account', meta, autoload = True)
 tb.append_column(Column('c',String(50)))
> 
> this code does not work properly, it adds a column in the table but in
> fact the table remains intact. Where mistake?

SQLA doesn't have automatic support for ALTER TABLE.   append_column() would 
normally be called before a create() is issued.

To work with ALTER, use a recipe like that described in 
http://www.sqlalchemy.org/docs/reference/ext/compiler.html#dialect-specific-compilation-rules
 or look into using sqlalchemy-migrate.



> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



[sqlalchemy] Append column

2010-03-12 Thread YAD
Hello

>>> from sqlalchemy import *
>>> engine = create_engine('mysql://root:r...@localhost/sqlalchemy')
>>> meta = MetaData(engine)
>>> tb = Table('account', meta, autoload = True)
>>> tb.append_column(Column('c',String(50)))

this code does not work properly, it adds a column in the table but in
fact the table remains intact. Where mistake?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.