(eng, schema=None)
| 143 | |
| 144 | |
| 145 | def _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 | |
| 161 | def _connect_with_retry(dialect, conn_rec, cargs, cparams): |
no test coverage detected