On Wed, Nov 11, 2009 at 5:08 PM, Russell Keith-Magee <[email protected]> wrote: > Multi-db allows you to set up multiple database credentials; the usual > reason for this is to split DB load across multiple database servers, > but I don't see any reason you couldn't also use it to provide > multiple connections to a single server, each with different > credentials. So - you should be able to use the using() query operator > to force a particular query to use a particular set of credentials > (and thus a particular database connection). >
So, if understand you correctly, with multi-db I could do the following for each request: 1. Retrieve the credentials from the session. 2. Create a new, or update an existing, entry for those credentials in the database configuration. 3. Somehow ensure that the using() operator is used on all ORM operations. Would this work? If so, I think it could be implemented as middleware. My only concern is #3. Could the ORM be made to check some request-specific place for a default using() argument if one is not passed explicitly? > I haven't given this particular use case enough thought to make any > comment on how the UI could be made cleaner. So far, we've been > concentrating on the 'user accounts are on db X', sharding model X > based on PK, and supporting master/slave replication as the end-user > use cases that we want to satisfy. Understood. Those use cases should take priority. >We'd certainly be interested in any > input on ways to improve usability for the multi-credential case. > Excellent. I'll do some experimentation and attempt to come up with some recommendations. Thanks. Your brief consideration of this is exactly what I am seeking. -- Warren Smith -- You received this message because you are subscribed to the Google Groups "Django developers" 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/django-developers?hl=.
