MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / drop_views

Function drop_views

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

Source from the content-addressed store, hash-verified

308
309
310def drop_views(cfg, eng):
311 inspector = inspect(eng)
312
313 try:
314 view_names = inspector.get_view_names()
315 except NotImplementedError:
316 pass
317 else:
318 with eng.begin() as conn:
319 for vname in view_names:
320 conn.execute(
321 ddl.DropView(schema.Table(vname, schema.MetaData()))
322 )
323
324 if config.requirements.schemas.enabled_for_config(cfg):
325 try:
326 view_names = inspector.get_view_names(schema=cfg.test_schema)
327 except NotImplementedError:
328 pass
329 else:
330 with eng.begin() as conn:
331 for vname in view_names:
332 conn.execute(
333 ddl.DropView(
334 schema.Table(
335 vname,
336 schema.MetaData(),
337 schema=cfg.test_schema,
338 )
339 )
340 )
341
342
343def drop_materialized_views(cfg, eng):

Callers 1

drop_all_schema_objectsFunction · 0.85

Calls 5

inspectFunction · 0.90
enabled_for_configMethod · 0.80
get_view_namesMethod · 0.45
beginMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected