Opened 4 years ago
Last modified 4 years ago
#33496 closed New feature
mirror database in django — at Initial Version
| Reported by: | M Hadi Azarabad | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 4.0 |
| Severity: | Normal | Keywords: | multi-database / mirror database |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Hi. I'm looking for a solution to save data on mirror database. using database routers allow us to save a record and let's us decide which database must be used and i think manual database selection is not optimal because it uses ORM to create raw SQL twice or more (based on number of mirror database).
`
model_obj.save(using='db_1')
model_obj.save(using='db_2')
`
i think django can handle this problem and optimize it by adding setting list variable called MIRROR_DATABASES so all mirror databases place in there and django save all of records by creating one raw SQL if mirror databases using the same backend