refactor: rename drop_db / drop_database to drop_all_tables, expose database from connection (#2098)

If we start supporting external catalogs then "drop database" may be
misleading (and not possible). We should be more clear that this is a
utility method to drop all tables. This is also a nice chance for some
consistency cleanup as it was `drop_db` in rust, `drop_database` in
python, and non-existent in typescript.

This PR also adds a public accessor to get the database trait from a
connection.

BREAKING CHANGE: the `drop_database` / `drop_db` methods are now
deprecated.
This commit is contained in:
Weston Pace
2025-02-06 13:22:28 -08:00
committed by GitHub
parent 6bf742c759
commit 1a449fa49e
11 changed files with 102 additions and 11 deletions

View File

@@ -170,12 +170,11 @@ impl Connection {
})
}
pub fn drop_db(self_: PyRef<'_, Self>) -> PyResult<Bound<'_, PyAny>> {
pub fn drop_all_tables(self_: PyRef<'_, Self>) -> PyResult<Bound<'_, PyAny>> {
let inner = self_.get_inner()?.clone();
future_into_py(
self_.py(),
async move { inner.drop_db().await.infer_error() },
)
future_into_py(self_.py(), async move {
inner.drop_all_tables().await.infer_error()
})
}
}