MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / drop_all_tables_from_metadata

Function drop_all_tables_from_metadata

lib/sqlalchemy/testing/util.py:372–392  ·  view source on GitHub ↗
(metadata, engine_or_connection)

Source from the content-addressed store, hash-verified

370
371
372def drop_all_tables_from_metadata(metadata, engine_or_connection):
373 from . import engines
374
375 def go(connection):
376 engines.testing_reaper.prepare_for_drop_tables(connection)
377
378 if not connection.dialect.supports_alter:
379 from . import assertions
380
381 with assertions.expect_warnings(
382 "Can't sort tables", assert_=False
383 ):
384 metadata.drop_all(connection)
385 else:
386 metadata.drop_all(connection)
387
388 if not isinstance(engine_or_connection, Connection):
389 with engine_or_connection.begin() as connection:
390 go(connection)
391 else:
392 go(engine_or_connection)
393
394
395def drop_all_tables(

Callers 4

provide_metadataFunction · 0.85
metadataMethod · 0.85
_teardown_each_tablesMethod · 0.85

Calls 2

goFunction · 0.70
beginMethod · 0.45

Tested by

no test coverage detected