On Sun, Nov 15, 2015 at 12:04 AM, <[email protected]> wrote:

> Thanks for the answer.
> What do you suggest to use instead of this ugly method, raw sql?
>

Would it make sense to serialize a ModelDatabaseA object (perhaps into JSON
or a standard Python dict) and use that to populate/create a ModelDatabaseB
object, so that all of the references to the original database would be
stripped away? Maybe even use a ModelDatabaseA object directly as an
argument in a class method to return a ModelDatabaseB object. You could
then implement a custom DB router to make sure that all queries for
ModelDatabaseB would go to/from your second database?

https://docs.djangoproject.com/en/1.8/topics/db/multi-db/#automatic-database-routing

To me, this would be a preferred method over mangling the internal _meta
information. It would also give you more control over what fields are
transferred, say if ModelDatabaseB was only a subset of ModelDatabaseA.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVuvnUYfwsFxgJgPst2xSVcLL8dYMtuQa9v2LKLf8Wb6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to