MCPcopy
hub / github.com/tortoise/tortoise-orm / _choose_db

Method _choose_db

tortoise/models.py:1255–1266  ·  view source on GitHub ↗

Return the connection that will be used if this query is executed now. :param for_write: Whether this query for write. :return: BaseDBAsyncClient:

(cls, for_write: bool = False)

Source from the content-addressed store, hash-verified

1253
1254 @classmethod
1255 def _choose_db(cls, for_write: bool = False) -> BaseDBAsyncClient:
1256 """
1257 Return the connection that will be used if this query is executed now.
1258
1259 :param for_write: Whether this query for write.
1260 :return: BaseDBAsyncClient:
1261 """
1262 if for_write:
1263 db = router.db_for_write(cls)
1264 else:
1265 db = router.db_for_read(cls)
1266 return db or cls._meta.db
1267
1268 @classmethod
1269 async def get_or_create(

Callers 9

saveMethod · 0.95
deleteMethod · 0.95
fetch_relatedMethod · 0.95
refresh_from_dbMethod · 0.95
get_or_createMethod · 0.45
_db_querysetMethod · 0.45
update_or_createMethod · 0.45
createMethod · 0.45
fetch_for_listMethod · 0.45

Calls 2

db_for_writeMethod · 0.45
db_for_readMethod · 0.45

Tested by

no test coverage detected