Simple modeling of existing SQL Server database schema in Python
I'm looking to write a few small tools for managing table content for an existing SQL Server 2005 DB. I have a few dozen tables of reference content for an application that is deployed on many client databases (often for different schema versions) and I want to build a few python scripts to export, import, diff, and merge this conten开发者_运维技巧t across versions while maintaining referential integrity. Is there a simple way to automatically generate python classes to model this content for each database release? I am primarily a sql developer with only a bit of python and java experience, so the simpler the better.
EDIT: Forgot to mention that I'd not only like to be able to create the model, but also easily populate the objects from an existing db.
SqlAlchemy may actually help you . You can have a look here http://www.sqlalchemy.org/docs/05/ormtutorial.html
Django has documentation on using it with legacy databases, but you will still have to handle things such as specifying relations yourself.
精彩评论