MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _purge_recyclebin

Function _purge_recyclebin

lib/sqlalchemy/dialects/oracle/provision.py:145–158  ·  view source on GitHub ↗
(eng, schema=None)

Source from the content-addressed store, hash-verified

143
144
145def _purge_recyclebin(eng, schema=None):
146 with eng.begin() as conn:
147 if schema is None:
148 # run magic command to get rid of identity sequences
149 # https://floo.bar/2019/11/29/drop-the-underlying-sequence-of-an-identity-column/ # noqa: E501
150 conn.exec_driver_sql("purge recyclebin")
151 else:
152 # per user: https://community.oracle.com/tech/developers/discussion/2255402/how-to-clear-dba-recyclebin-for-a-particular-user # noqa: E501
153 for owner, object_name, type_ in conn.exec_driver_sql(
154 "select owner, object_name,type from "
155 "dba_recyclebin where owner=:schema and type='TABLE'",
156 {"schema": conn.dialect.denormalize_name(schema)},
157 ).all():
158 conn.exec_driver_sql(f'purge {type_} {owner}."{object_name}"')
159
160
161def _connect_with_retry(dialect, conn_rec, cargs, cparams):

Calls 4

beginMethod · 0.45
exec_driver_sqlMethod · 0.45
allMethod · 0.45
denormalize_nameMethod · 0.45

Tested by

no test coverage detected