[Answer]-Django — Multiple Databases — Data Migration

1👍

The documentation here https://docs.djangoproject.com/en/1.6/topics/db/multi-db/#manually-selecting-a-database is quite clear.

Assuming you have “db_for_read” and “db_for_write” configured in your settings, for the reading:

YourModel.objects.using("db_for_read").all()

For the writing – per instance:

your_model_instance.save(using="db_for_write")

or in batch:

YourModel.objects.using("db_for_write").bulk_create(
    [your_model_instance1, your_model_instance2, etc]
    )

Leave a comment