An as-yet unsolved multi-DB problem
Originally posted to the Django users group:
- "We're building a couple of different projects - one social network-y site, and one that's bloglike. So each has its own unique database, but they do share one common set of content.
I've created a third "common" project to hold the base models, at least - the model inheritance seems to be working, but for instances of each class, each project is still looking to its own database.
Obviously, I don't want to recreate that same content in each database - I need to be able to maintain it in just one common database. But I can't figure out how to get the blog and network projects to look to this common database for this specific piece of content.
I'm just looking for ideas - I realize this falls within the realm of multi-DB support, which is sort-of-there-but-not-really. Am I going to have to resort to raw SQL to hit this third database? Has anyone solved this problem and if so, what was your strategy?"
Comment by
mamcx
on Oct 16, 2008:
I mainly work on MS Sql and in similar situations I build a remote view from the other DB or datasource. I don't know what kind of backend you have, but maybe PG or MySql have something similar.
Other option is simply chain both project... you know, this is the HTTP world and nothing stop you to get & post from multiples places :)
So, you can have:
app1.site.com
app2.site.com
and serve from app1 the views of app2, and using pipes or xmlrpc or something connect both... this is my solution for more convoluted scenarios or when have sense build a common "service" that is reusable.
Comment by
Thierry Stiegler
on Oct 16, 2008:
I got a similar problem, and it was on MySQL. I use views, and I change the db_table attributes. A todo is a new syncdb like systems.
It's not perfect but it was just for sharing in read only.

