开发者

SQLAlchemy: Any way to convert MetaData to Table statements?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜