SQLALchemy doesn't (directly) contain functions for altering tables. You
may be interested in the sqlalchemy-migrate project:
http://code.google.com/p/sqlalchemy-migrate/
The first example on this page shows how to add a column:
http://code.google.com/p/sqlalchemy-migrate/wiki/MigrateChangeset
Hope that helps,
Simon
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of
jarrod.ches...@gmail.com
Sent: 12 December 2008 07:08
To: sqlalchemy
Subject: [sqlalchemy] Re: Create tables with metadata
Doesn't get created in the database.
How do i add columns to tables already defined in the database after i
have reflected them into the metadata
On Dec 12, 12:59 am, Empty mtr...@gmail.com wrote:
Hi,
On Thu, Dec 11, 2008 at 8:12 AM, jarrod.ches...@gmail.com
jarrod.ches...@gmail.com wrote:
Hi
I've scoured the documentation and i can't find any info on how to
create a column using metadata.
from sqlalchemy import engine
from sqlalchemy import schema
from sqlalchemy import types
_config_dbengine = engine.create_engine('sqlite:tmp/db')
_config_metadata = schema.MetaData(_config_dbengine, reflect=True)
table = _config_metadata.tables['table_name']
table.append_column(schema.Column('id', types.Integer,
primary_key=True, autoincrement=True))
This is the steps i'm using but the column doesn't get created.
Doesn't get created where? In the database? That's not
going to happen.
Are you saying it's not included as part of the table definition?
Michael
--~--~-~--~~~---~--~~
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@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
-~--~~~~--~~--~--~---