1

I'm trying to figure out the best method to do this. As usual, there are some good pointers on the django documentation, but I'm still not sure what's the best approach.

The django app uses an essentially non-managed DB (it's rather complex, using views, triggers etc, so for example, syncdb doesn't work). That's ok however, since the DBA here creates his own database migrations, and manages the database irrespective of django.

However, I want to use some external 3rd party apps, and those some time come with some of their own database tables. I'd very much like to be able to syncdb those and manage those independently. Since the app-tables are usually independent of the core-app tables, the idea I'm currently playing with is therefore to use a separate 'other' database for 3rd party apps.

Reading through the guide it seems to make sense to create a custom router and based on the app name, route it to this 'other' database. However, what happens if the app also needs to interact with existing models? Is it possible / sensible to create a router that will effectively route all of the app-specific tables into the 'other' database and anything else to the 'default' database? Is there a generic way to accomplish this without hard-coding all 3rd party tables somewhere in the router?

1 Answer 1

1

It was a silly question. Must be some caffeine deficiency or adverse reaction to snow. I simply didn't realise that the database router functions get the model as a parameter and can easily make a per-model (rather than per-app) decision.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.