Return the connection that will be used if this query is executed now. :return: BaseDBAsyncClient:
(self, for_write: bool = False)
| 114 | self._capabilities = value |
| 115 | |
| 116 | def _choose_db(self, for_write: bool = False) -> BaseDBAsyncClient: |
| 117 | """ |
| 118 | Return the connection that will be used if this query is executed now. |
| 119 | |
| 120 | :return: BaseDBAsyncClient: |
| 121 | """ |
| 122 | if self._db: |
| 123 | return self._db |
| 124 | if for_write: |
| 125 | db = router.db_for_write(self.model) |
| 126 | else: |
| 127 | db = router.db_for_read(self.model) |
| 128 | return db or self.model._meta.db |
| 129 | |
| 130 | def _choose_db_if_not_chosen(self, for_write: bool = False) -> None: |
| 131 | if self._db is None: |
no test coverage detected