Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask YC: Anyone have a good implementation for multiple database support in Django?
20 points by shafqat on Nov 11, 2008 | hide | past | favorite | 17 comments
We're looking at Django, and while we love most of what we see in the 1.0 release, I'm a bit worried about the lack of multiple database support.

Has anyone here implemented this (basic usages for mysql master/slave(s) replication)? I'm not too concerned with sharding at the moment?

If you have done this, care to share ideas? Thoughts? Code?

Thanks all!



Don't do this in Django. Just don't.

This should be done with a database proxy server. With MySQL, you can use MySQL Proxy and PostgreSQL has pgpool-II.

Yes, you could hack the Django code to solve your problem. Why do that when there is a very simple and tested product that already does that transparently? For me, supporting multiple databases in a web framework is akin to writing an HTTP server into your web framework. Maybe you should do it for testing purposes, but not for production.


There are reasons why mysql_replicated backend was created and used successfully in production instead of MySQL Proxy.

For example, MySQL Proxy knows nothing about transactions.


Just after DjangoCon there was a long discussion on django-dev about implementing multi-db support in the upcoming releases:

http://groups.google.com/group/django-developers/browse_thre...

Also, according to JKM, Django 1.0 does suport multi-db, it's just undocumented and at a lower level:

http://www.reddit.com/r/programming/comments/6zbos/django_10...

HTH.


Followup (better late than never, right?) --

A few days after my post, Eric Florenzano put up a how-to for multi-db support in Django:

http://www.eflorenzano.com/blog/post/easy-multi-database-sup...


Thanks for the links. Sounds promising!


At DjangoCon I heard Pownce was doing that internally, you might want to ping them.


Good idea. I'll send Leah an email...


MySQL master/slave replication is implemented:

http://softwaremaniacs.org/soft/mysql_replicated/en/

I'm not sure whether authors are here or not.


Unless my memory fails me, in the "What Ponies do you want in Django?" session, this one came up quite a bit. Adrian and Jacob said that this was one of their top priorities, and suggested that it might make it into Django 1.1.

You could probably get a better response on the Django-users or Django-dev mailing lists.


do you agree that good database design means good database implementation?


bmk


i'm just trying to bookmark this article so that it appears under my comments. if anyone can suggest a better way (and bookmarking on the browser is not good enough, as i move around computers all day)


If you upvote this article, it will show up under "saved" in your member profile page.


ah thanks. is there a limit?


How about saying something marginally intelligent. ;-)


um, delicious?


thanks. i stopped using it about a year ago because it was getting really slow. maybe i should have another looksie.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: