MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / drop_all_schema_objects

Function drop_all_schema_objects

lib/sqlalchemy/testing/provision.py:278–308  ·  view source on GitHub ↗
(cfg, eng)

Source from the content-addressed store, hash-verified

276
277
278def drop_all_schema_objects(cfg, eng):
279 drop_all_schema_objects_pre_tables(cfg, eng)
280
281 drop_views(cfg, eng)
282
283 if config.requirements.materialized_views.enabled:
284 drop_materialized_views(cfg, eng)
285
286 inspector = inspect(eng)
287
288 consider_schemas = (None,)
289 if config.requirements.schemas.enabled_for_config(cfg):
290 consider_schemas += (cfg.test_schema, cfg.test_schema_2)
291 util.drop_all_tables(eng, inspector, consider_schemas=consider_schemas)
292
293 drop_all_schema_objects_post_tables(cfg, eng)
294
295 if config.requirements.sequences.enabled_for_config(cfg):
296 with eng.begin() as conn:
297 for seq in inspector.get_sequence_names():
298 conn.execute(ddl.DropSequence(schema.Sequence(seq)))
299 if config.requirements.schemas.enabled_for_config(cfg):
300 for schema_name in [cfg.test_schema, cfg.test_schema_2]:
301 for seq in inspector.get_sequence_names(
302 schema=schema_name
303 ):
304 conn.execute(
305 ddl.DropSequence(
306 schema.Sequence(seq, schema=schema_name)
307 )
308 )
309
310
311def drop_views(cfg, eng):

Callers

nothing calls this directly

Calls 9

inspectFunction · 0.90
drop_viewsFunction · 0.85
drop_materialized_viewsFunction · 0.85
enabled_for_configMethod · 0.80
beginMethod · 0.45
get_sequence_namesMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected