Hi, I could be completely wrong on this, but based on what I have read in the TG source, I think you can use:
db1.dburi=... db2.dburi=... db3.dburi=... in the config file (where db[1-3] can be anything). It seems that sqlobject.dburi is in fact a fallback entry is a package specific entry cannot be found. If you then have 3 model files, each setting the PackageHub to db1, db2, and db3 respectively, then that could work. A further possible step is to set __connection__ on each model to the appropriate PackageHub within a single model file. This still required 3 models, though. Also, I'm not sure about hub, then. Maybe no have a global hub in model.py but make a hub attribute on each model class? Lastly, I suppose, if you wanted to use the same model classes, you could instantiate them and then monkeypatch the __connection__ attribute afterwards to use the correct PackageHub. Anyway, this is all conjecture. I've never actually done it, but the code seems to support this. Hope this helps, Krys Jorge Godoy wrote: > Em Sábado 10 Junho 2006 03:21, nEO (a.k.a. gentoo.cn) escreveu: > > > > I need 3 different database connection in my application. > > Should I use 3 model files? > > That depends on your design of the application. If you know you can't use FKs > from one table to another in a different database, you can't inherit from > tables on different databases, etc. then you can use the same model. You'll > have to have three different connection pools and you'll need to say to which > database the mapped class belongs to. > > In SQL Object you'd use the connection attribute inside the sqlmeta > metaclass... I don't know how you'd do that with SQL Alchemy. > > -- > Jorge Godoy <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

