Jan Meszaros reflections on technology and society

21Oct/092

Django multiple database support with DB switch feature

Our Django installation is capable to connect to as many databases as desired and switch between databases in according to session data. We reached this feature overriding several internal Django classes, according to recommendations on http://groups.google.com/group/django-users/msg/d1d7e0af565cc444?. All multiple database features are done without changes in original Django code.

Partial how-to can be found on http://kfalck.net/2009/07/01/multiple-databases-and-sharding-with-django too.

The solution is successfully tested for more than one month in real-world application and this application is going to be used into production environment soon.

For implementation details or questions leave a comment below.