Yes - a low-level API for this is in place, at the moment there is no convenient high-level API. These are quotes from James Bennett (Django Release Manager) on reddit programming :
He has been there - in an extremely low-level API for those looking at the codebase - for several months (each QuerySet supported by Query , which in turn takes a database connection as an argument). There is no high level documented API for it, but I know people who already do and have done things like scripts with multiple DB / sharding.
... this is not necessarily something that requires a great review; __init__() method of the QuerySet takes an argument from the Query keyword, which must be an instance of django.db.models.sql.Query . The __init__() Query method, in turn, takes an argument to the connection keyword, which must be an instance (the base subclass of your database) django.db.backends.BaseDatabaseWrapper .
From there it is pretty easy; you could, for example, override get_query_set() in the manager to always return a QuerySet with the connection you need, or configure things like ball logic to figure out which database to use based on the incoming query parameters, etc. etc..
source share