> > Hi , > > [...] > > But do I do this? Part of the problem is that I don't know of a way > to generate tables other than create_all() (or drop_all()) when using > declarative syntax. Is there another way? >
Hi Shane :) When you bind your declarative base to a metadata, the "metadata" object has a attribute called "tables", wich is a dict with all tables containeds in this metadata. So, you can do a create for a single table easily. >>> Base.metadata.tables['test_case'].create(engine) >>> You can call it on your upgrade function inside the migration module. 2) Can MySQL wrap Table.create() in a transaction so that if something fails > during upgrade/downgrade I don't litter up my DB with tables? I don't think > MySQL can, but maybe I am wrong. I think some others (PostgreSQL) can. > I do not know how to answer this question, becausa I am not experienced with MySQL, but I can check this out. What I know is that MySQL supports transactions only when you are working with InnoDB engine. Best wishes, Francisco Souza Software developer at Giran and also full time Open source evangelist at full time http://www.franciscosouza.com.br Twitter: @franciscosouza (27) 3026 0264 -- 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.
