On Sep 10, 10:15 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > Simon Willison wrote: > > * Simple master-slave replication: SELECT queries are distributed > > between slaves, while UPDATE and DELETE statements are sent to > > the master. > > It won't work on a statement-level. If you have a transaction and do an > UPDATE and then a SELECT then the latter won't see results of the former > because it will look into another connection (and another database). > > I strongly believe that choosing between a master and a slave is the > decision that should be made on business logic level, not at model level.
Good point. That also highlights an omission in my original brain-dump - having a "uses" method on a QuerySet isn't enough, you also need a way of over-riding the database connection used by a call to model.save(). Again, I'd propose the same terminology again as a keyword argument. If you wanted to control which master/slave connection was used from your business logic, you'd do something like this: obj = Article.objects.using('master').get(pk = 4) obj.name = 'Hello' obj.save(using = 'master') Ivan: how does that look? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---