iceberg-go icon indicating copy to clipboard operation
iceberg-go copied to clipboard

can you support delete table with param purge

Open anvsk opened this issue 4 months ago • 1 comments

Feature Request / Improvement

now ,i use the catalog of rest to drop table , got error:DropTable operation failed. S3 Tables only supports dropping tables with purge enabled.

anvsk avatar Sep 19 '25 06:09 anvsk

You should be able to use catalog::PurgeTable instead:

func (r *Catalog) PurgeTable(ctx context.Context, identifier table.Identifier) error {
	ns, tbl, err := splitIdentForPath(identifier)
	if err != nil {
		return err
	}

	uri := r.baseURI.JoinPath("namespaces", ns, "tables", tbl)
	v := url.Values{}
	v.Set("purgeRequested", "true")
	uri.RawQuery = v.Encode()

	_, err = doDelete[struct{}](ctx, uri, []string{}, r.cl,
		map[int]error{http.StatusNotFound: catalog.ErrNoSuchTable})

	return err
}

twuebi avatar Sep 22 '25 10:09 twuebi