Django Specifying different databases in code


Example

The normal obj.save() method will use the default database, or if a database router is used, it will use the database as specified in db_for_write. You can override it by using:

obj.save(using='other_db')
obj.delete(using='other_db')

Similarly, for reading:

MyModel.objects.using('other_db').all()