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

Function drop_views

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

Source from the content-addressed store, hash-verified

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