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

Function _truncate_all_tables

conftest.py:31–38  ·  view source on GitHub ↗

Truncate all tables in the given context.

(ctx)

Source from the content-addressed store, hash-verified

29
30
31async def _truncate_all_tables(ctx) -> None:
32 """Truncate all tables in the given context."""
33 if ctx.apps:
34 for model in ctx.apps.get_models_iterable():
35 quote_char = model._meta.db.query_class.SQL_CONTEXT.quote_char
36 await model._meta.db.execute_script(
37 f"DELETE FROM {quote_char}{model._meta.db_table}{quote_char}" # nosec
38 )
39
40
41# ============================================================================

Callers 2

dbFunction · 0.85
db_truncateFunction · 0.85

Calls 2

get_models_iterableMethod · 0.80
execute_scriptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…