Nope, seems this is actually impossible (at least using manage.py
shell), since it will load all of the models and hold references to
them on initialization until termination, so the settings-definte
backend is tied to BaseQuery forever :(

On Mar 17, 12:01 pm, Oliver Beattie <oli...@obeattie.com> wrote:
> Thanks for your quick reply :)
>
> Basically, what I want to do has to apply to every query made to the
> database, not just one query. Basically, I want to do a dry-run of
> some things before doing them. Since MySQL doesn't support schema
> alterations inside a transaction, I can't do it that way.
>
> I'm sadly bound to using the release version of Django… so will this
> apply?
>
> On Mar 16, 10:25 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
>
>
>
> > On Mon, Mar 16, 2009 at 6:20 PM, Oliver Beattie <oli...@obeattie.com> wrote:
>
> > > Does anyone know if it's possible to switch the database backend in
> > > Django at runtime (let's say I want to use dummy for something, but
> > > then switch it back to the original after I'm done).
>
> > > Is this possible using django.db.load_backend or something (I'm
> > > doubting it as I see there is some module-level code in there that
> > > takes info directly from settings).
>
> > > I know it's a bit of a cardinal sin, but would altering settings at
> > > runtime have any effect? Again probably no since there will still be
> > > things pointing to the old backend instance, but worth a shot.
>
> > It sort of depends on what you're trying to do, if you want to work with a
> > queryset using a different database you can do something like 
> > this:http://www.eflorenzano.com/blog/post/easy-multi-database-support-djan...
> > for if you're using django trunk you can use django.db.load_backend
> > and the new DatabaseWrapper constructor(which takes a dict of settings) to
> > do it, instead of futzing with the global settings.
>
> > Alex
>
> > --
> > "I disapprove of what you say, but I will defend to the death your right to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to