MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / drop_all_schema_objects

Function drop_all_schema_objects

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

Source from the content-addressed store, hash-verified

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