You don't need to define your tables inside init_model itself, but init_model will be called after the metadata is setup and engine defined, but before your app is loaded, so it's an obvious place from which to manage table reflection.
You can call other functions or class methods from init_model, so you can split things up as you choose. On Wed, May 27, 2009 at 9:03 PM, Uwe C. Schroeder <[email protected]> wrote: > > > Hi Everyone, > > congrats on the final release of 2.0. I've been waiting for that to happen and > after I saw the announcement today I immediately downloaded it. > > I'm running a TG1 application (www.bunspace.com) which is rather large. So I > have many controllers for the different sections of the page (forum, blogs > etc.) and over 100 database tables. > > I'd like to migrate the whole thing to TG2 - speed reasons are one of the > points, continuing long term support another and certainly I want to utilize > all the new features. > > This all said: migrating a large app is expectedly painful. My most pressing > concern right now is reflection of tables, but the docs are sketchy at best > on this point and all I can find is that I really have to define 100+ classes > inside the init_model function of xxx.model.__init__.py > That will create a couple thousand lines of code in one method - not sure I > like that. Isn't there another way to reflect the tables in __init__.py and > define the classes to be mapped in other modules? > And no, typing up all the column definitions just to avoid reflection is not > really an option. I'll never use the auto generation of tables as I rather > deal with my database myself when it comes to schema changes. That's what > database modeling tools are for. Typing up every column, relation and > constraint is fine with little apps where the table constraints are few and > simple, but not when you have hundreds, if not thousands of constraints and > relations. For large, complex databases that kind of coding kills you over > time because it's not manageable - and IMHO database creation isn't the > concern of a web-framework. It's nice for a quick-start, but bad for > large-scale apps that have to share the database with other applications. > > The second thing I've noticed is that there is no "registration" module > anymore. Did I miss that? For a "social networking" site like the one I run, > self-signup is crucial. Maybe someone wrote a replacement similar to the > functionality that was available in 1.0? Pointers would be very much > appreciated. > > Other than that TG2 looks very promising right now. But I guess I'll be back > with more remarks or questions :-) > > Thanks > > Uwe > > > > > -- Mark Ramm-Christensen email: mark at compoundthinking dot com blog: www.compoundthinking.com/blog --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---

