MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / drop_all

Function drop_all

test/perf/many_table_reflection.py:543–559  ·  view source on GitHub ↗
(engine, schema_name)

Source from the content-addressed store, hash-verified

541
542
543def drop_all(engine, schema_name):
544 with engine.connect() as conn:
545 table_names = engine.dialect.get_table_names(conn, schema=schema_name)
546 print(f"Dropping {len(table_names)} tables")
547 dn = engine.dialect.name
548 i = 0
549 while table_names:
550 name = table_names.pop()
551 try:
552 conn.execute(_drop_ddl(name, schema_name, dn))
553 conn.commit()
554 except Exception:
555 conn.rollback()
556 table_names.insert(0, name)
557 i += 1
558 if i % 25 == 0:
559 print(f"Still running. Tables left {len(table_names)}")
560
561
562if __name__ == "__main__":

Callers 1

mainFunction · 0.85

Calls 8

_drop_ddlFunction · 0.85
connectMethod · 0.45
get_table_namesMethod · 0.45
popMethod · 0.45
executeMethod · 0.45
commitMethod · 0.45
rollbackMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected