Let's say I create a table with metadata using something like the
following:
metadata = MetaData()
self.address_table = Table('address', metadata,
Column('id', Integer,
primary_key=True),
Column('email', String
(255),unique=True))
let us then suppose that I use this table in a MySQL DB for some time,
accumulating rows.
At some time later, I want to add a new column to that Table, so I
modify the above code to look like:
self.address_table = Table('address', metadata,
Column('id', Integer,
primary_key=True),
Column('email', String
(255),unique=True),
Column('name',String(255)))
I'd like to update the database (do the equivalent of an 'ALTER TABLE'
SQL command) without destroying all of the data I already have. How
do I do this?
I have already tried using:
metadata.create_all(engine,checkfirst=True)
which can handle _new_ tables being added, it seems, but doesn't seem
to update the tables for which I have altered the definitions using
the Table object.
I'm using SQLAlchemy '0.5.0beta3', with Python 2.5 on Mac OS X.
Thanks,
Mike
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---