For various reasons, I'd like to write out my MetaData object as a python script containing SQLAlchemy Table declarations.
Stated a different way, given a well-designed, but completely unknown database, what's the best way to write an SQLAlchemy definition of the database Table's in a fully automated way? It seems like MetaData reflection, plus some kind of write-Tables routine would be the way to go, but if there's a better way, I'll take it开发者_如何学JAVA.
SQLAlchemy Migrate has the create_model
command, see http://packages.python.org/sqlalchemy-migrate/versioning.html#experimental-commands . It has experimental status but I found it useful on several occasions.
精彩评论