[sqlalchemy] Create tables from class declaration

2012-08-21 Thread andrea crotti
The question is probably very simple, but I can't find an answer anywhere... Suppose I already have some tables declarad in a declarative way, as below, how do I create the database schema from them? I usually always did with the meta.create_all() after defining the various Table('name', meta...)

Re: [sqlalchemy] Create tables from class declaration

2012-08-21 Thread Simon King
On Tue, Aug 21, 2012 at 5:25 PM, andrea crotti andrea.crott...@gmail.com wrote: The question is probably very simple, but I can't find an answer anywhere... Suppose I already have some tables declarad in a declarative way, as below, how do I create the database schema from them? I usually

Re: [sqlalchemy] Create tables from class declaration

2012-08-21 Thread andrea crotti
2012/8/21 Simon King si...@simonking.org.uk: The MetaData instance is available via the declarative base class, so you should be able to do something like: Base.metadata.create_all() http://docs.sqlalchemy.org/en/rel_0_7/orm/extensions/declarative.html#accessing-the-metadata Hope that

Re: [sqlalchemy] Create tables from class declaration

2012-08-21 Thread Michael Bayer
On Aug 21, 2012, at 12:50 PM, andrea crotti wrote: 2012/8/21 Simon King si...@simonking.org.uk: The MetaData instance is available via the declarative base class, so you should be able to do something like: Base.metadata.create_all()