Opened 4 years ago
Last modified 4 years ago
#33496 closed New feature
mirror database in django — at Version 1
| 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 (last modified by )
Hi. I'm looking for a solution to save data on mirror database. Using database routers allow us to save a record and lets 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 the 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.