feat: add a cascade option to drop_database (#4697)

The remote catalog could only drop an empty database: it always asked
the server for a restricted drop.

`DropDatabaseRequest::cascade`, `drop_database(..., cascade=True)` in
Python and `dropDatabase(name, { cascade: true })` in TypeScript ask the
server to drop everything in the database first. The name stays taken
until the server finishes cleaning up the dropped objects' storage. A
restricted drop remains the default.
This commit is contained in:
Wyatt Alt
2026-10-27 21:51:10 -07:00
committed by GitHub
parent 45dbf5eff5
commit bb6aa1a147
10 changed files with 98 additions and 24 deletions
+5 -2
View File
@@ -86,7 +86,10 @@ describe("remote catalog", () => {
value: "team/search",
});
expect(names.pageToken()).toBe("next");
await catalog.dropDatabase("team/search", { ignoreMissing: true });
await catalog.dropDatabase("team/search", {
ignoreMissing: true,
cascade: true,
});
expect(requests[0].url).toBe("/v1/namespace/team%2Fsearch/create");
expect(requests[0].body).toEqual({ mode: "ExistOk" });
expect(requests[5].url).toBe(
@@ -94,7 +97,7 @@ describe("remote catalog", () => {
);
expect(requests[6].body).toEqual({
mode: "Skip",
behavior: "Restrict",
behavior: "Cascade",
});
for (const [i, request] of requests.entries()) {
expect(request.headers["x-lancedb-database"]).toBe(