On Tuesday 19 September 2006 16:14, Tjaart de Beer wrote: > Hi > > I have scoured the web in search of an answer. Is there a way to create > your model.py file by reverse engineering an existing database? If > possible the code must be usable by SQLAlchemy. > > We are working with an existing database (+- 120 tables with 20-30 > columns in each tables) and would like to connect and manipulate this > database from TG using SQLAlchemy. ANY ideas/suggestions are welcome!
Frommy general experience with ORM: no, there isn't. Usually, a hand-written schema is not as normalized as an ORM wishes, and even if it was, some pesky details usually get in your way. You have several options: - write a new model in SA, and a migration. However, that means that no old code works anymore. - try and map as much as possible using SA, tweaking it or at least the model classes where necessary. But that is only a good idea if you come as far as lest say 80 or even 90 percent because the old design is proper (e.g. no compound keys and the like) - write you own model without any ORM at all, just using plain SQL and some magic, for example attribute access. -- >> Diez B. Roggisch >> Developer T +49 (30) 443 50 99 - 27 F +49 (30) 443 50 99 - 99 M +49 (179) 11 75 303 E [EMAIL PROTECTED] >> artnology GmbH A Milastraße 4 / D-10437 Berlin T +49 (30) 443 50 99 - 0 F +49 (30) 443 50 99 - 99 E [EMAIL PROTECTED] I http://www.artnology.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~----------~----~----~----~------~----~------~--~---

