On Mon, Jan 18, 2010 at 1:21 AM, Bill Hubauer <[email protected]> wrote: > > Hi all, > > I'm new to the group, so my apologies if this has been discussed > already. I have some serious reservations about the implementation > of the "default" database in the new multi-db support feature. > > Anytime you obtain a model from a given database (with the "using"), > shouldn't any operation on that model default to the database that it > *came from*, not the "default" database in the settings file?
As far as I'm aware, that's exactly what should be happening. If you retrieve an object from 'other', the object should retain an internal state that indicates that it came from 'other', and subsequent database operations (including save) should be directed to the 'other' database. There are some cases where this shouldn't happen - for example, in a master/slave setup. I'm tinkering with some code at the moment to control this sort of database allocation. However, in the trunk code that currently exists, an object retrieved from 'other' should be sticky on that database. > Sometimes the code that calls save on the model doesn't know (and > shouldn't care) where it came from. It seems really easy to > accidentally save a model back to a different database than it came > from. > > Thoughts? Have you got a specific failing case of example code where this is happening? Yours, Russ Magee %-)
-- 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=en.
