metadata / table comparison method
use case:
when the db-model changes in the application code and there is a database as of the old state, there is need to check / compare the (autoloaded) metadata of the database with the (new) one in the code. Options to do: * just say "different" * produce a iterable / hierarchy of differences, which can be programaticaly walked and eventualy resolved - or raised * these can be done on table/constraint/... level, and/or metadata level
Regardless of the method above, the process of autoloading the old-db-structure into some temporary metadata/table and comparing to the application's one could be distilled into something like * my_table_or_metadata.verify( connection) where the verify() methods would return whahever the my_xxx.compare( other_xxx) returns.
sdobrev@sistechnology.com
Comments (3)
-
Account Deleted -
Account Deleted (original author: ged) Isn't this usecase what migrate is supposed to do? Migrate seems almost defunct now but that might be a better starting point.
-
repo owner - changed status to wontfix
there's some code to do this in source:sqlalchemy/trunk/test/testlib/testing.py#L635 but that's as far as I'd want SQLA core to go on this. reflection is not at the moment meant to be a comprehensive view of a schema.
- Log in to comment
there are some usagerecipes in the wiki, may be a good start point: * http://www.sqlalchemy.org/trac/wiki/UsageRecipes/ModelUpdate * http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode