Not impossible at all. Just a lot of work :-) You'd have to build and maintain a little model generator script to detect a new table, determine its schema, and generate the models. Then what? Your application detects new models appearing and can autonomously decide what to do with each one? Sounds difficult (ie: expensive) to build because those bits would need to be entirely abstract.
Django can handle being told what the names of the tables are (class Meta deb_table = <tablename>) no problem. But given, the scope and dynamism of your described problem, it does sound like you'll be working against the grain: Any ORM, a db abstraction, does like to assume ownership of the underlying db, and it will typically resist outsiders seeking to dictate its internal affairs. On Mar 30, 8:48 am, Matthias <thecodebend...@gmail.com> wrote: > I'm relatively new to the Django world and I'm just starting on a new > project that may be right up the frameworks ally. But there's one > thing I'm a little iffy on after reading the documentation. > > I'm attempting to write an app that will allow for management of a > "parts" database that will allow for parts to be added with a couple > auto-generation features. The parts database I wish to edit is > maintained by a separate program called Altium, so the structure of > the database is pretty rigid, and the way it's set up is it creates > Tables for classes of parts (so all capacitors that are of size 0805 > will be found in the table, CAPS_0805). These tables are frequently > created as we run across a new class of part. So the names of the > tables that this app would be editing are far from static. It would > appear using the Models system of Django the tables which I could > setup all of Djangos magic on are pretty rigidly named (aka, I can't > just use some variable name to represent the table). > > The only solution I see right off to this would be to create a chron > job that would edit the models file for me after checking the database > (automatically creating models for each of the tables). I feel like > this is a hack to something that shouldn't really need one. Also, > then I think I would have to use dictionaries if I wanted to treat the > table names as variables in the program which looks ugly. (The user > will for example select which table the part needs to go in from a > drop down menu). > > Any insight here would be much appreciated. > > Thanks, > Matthias Welsh. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.