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

Method remove

tortoise/fields/relational.py:228–236  ·  view source on GitHub ↗

Removes one or more of ``instances`` from the relation. :raises OperationalError: remove() was called with no instances.

(self, *instances: MODEL, using_db: BaseDBAsyncClient | None = None)

Source from the content-addressed store, hash-verified

226 await self._remove_or_clear(using_db=using_db)
227
228 async def remove(self, *instances: MODEL, using_db: BaseDBAsyncClient | None = None) -> None:
229 """
230 Removes one or more of ``instances`` from the relation.
231
232 :raises OperationalError: remove() was called with no instances.
233 """
234 if not instances:
235 raise OperationalError("remove() called on no instances")
236 await self._remove_or_clear(instances, using_db)
237
238 async def _remove_or_clear(
239 self,

Callers 15

get_create_schema_sqlMethod · 0.80
db_deleteMethod · 0.80
state_forwardMethod · 0.80
state_forwardMethod · 0.80
state_forwardMethod · 0.80
generate_operationsMethod · 0.80
_match_renamed_modelsMethod · 0.80
test_m2m_removeFunction · 0.80
test_m2m_remove_twoFunction · 0.80
test__removeFunction · 0.80
test__remove__manyFunction · 0.80
test__remove__blankFunction · 0.80

Calls 2

_remove_or_clearMethod · 0.95
OperationalErrorClass · 0.90

Tested by 8

test_m2m_removeFunction · 0.64
test_m2m_remove_twoFunction · 0.64
test__removeFunction · 0.64
test__remove__manyFunction · 0.64
test__remove__blankFunction · 0.64
test__removeFunction · 0.64
test__remove__manyFunction · 0.64
test__remove__blankFunction · 0.64