Is there a Django utility or add-on that can read database schemas and turn them into Django data models *incrementally*?
By "incrementally", I mean that the utility would be able to update a set of already existing Django models so they match the current DB schema. In other words, the utility would incorporate changes to the schema that have been made at the DB level into the Django model set. It seems to me that this utility would have some or all of the following level of functionality, which I list in increasing order of difficulty: 1. Inspect a DB schema and create a Django model for every table in it. This is what inspectdb does. It's fine for initializing a Django app that doesn't already contain any data models. Level 1 functionality is easiest to implement, because the utility doesn't have to look at the existing model set at all. 2. Inspect a DB schema and create a Django model for user-selected tables in the schema. This extension seems easy to implement, as the utility still doesn't have to inspect the existing model set. Adding level 2 functionality would be a big help for those of us who need to evolve our DB schema directly at the DB level and then create-modify Django models to fit the DB, rather than vice-versa. For us, a level 1 utility is good only for a one-time run when initializing the model set of a brand-new app. A level 2 utility would spare us the error-prone and labor-intensive effort of creating subsequent models by hand. (As someone suggested elsewhere in this forum, it is possible to run inspectdb and then lop out the pre-existing models from its output file before adding the rest of them to the model set, but this is at best rather clunky.) 3. Inspect a DB schema and create a Django model for every table in the schema that doesn't already have a model in the existing model set. Harder to implement, because now the utility has to compare the schema with the model set - albeit at a quite coarse level: all it needs to ask is "Does this table already have a model or not?" Level 3 functionality would shave off some additional work, leaving only the altering and deleting of pre-existing models (and the impact of those changes on code) to be done by hand. 4. Inspect a DB schema and modify the Django model set so that they match completely. Much harder, because it involves (a) comparing every detail of each existing model with the DB schema, (b) altering and deleting models as well as just creating them, and (c) dealing with the problems that these alterations and deletions may cause for existing app code. The last point in particular is a big hurdle. So level 4 functionality may not be worth the effort - but if someone has already gone to the trouble of building it, great to have! So my question is: Has anybody built something that provides functionality beyond level 1? If so, where is it and what can it do? ~ TIA, Ken -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f0572b3c-39ae-4f59-829e-bc5d382bac4e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.