diff --git a/open-api/rest-catalog-open-api.py b/open-api/rest-catalog-open-api.py index 30ae491248fa..393f8bd245dc 100644 --- a/open-api/rest-catalog-open-api.py +++ b/open-api/rest-catalog-open-api.py @@ -1575,6 +1575,19 @@ class CreateTableRequest(BaseModel): properties: dict[str, str] | None = None +class UnregisterTableResult(BaseModel): + """ + Last metadata location and the corresponding table metadata for the table that was successfully unregistered and is no longer tracked by the catalog. + """ + + metadata_location: str = Field( + ..., + alias='metadata-location', + description='The last metadata location for the table at the time it was unregistered.', + ) + metadata: TableMetadata + + class CreateViewRequest(BaseModel): name: str location: str | None = None diff --git a/open-api/rest-catalog-open-api.yaml b/open-api/rest-catalog-open-api.yaml index 0e5cd9c95e75..ccad6004aede 100644 --- a/open-api/rest-catalog-open-api.yaml +++ b/open-api/rest-catalog-open-api.yaml @@ -1217,6 +1217,56 @@ paths: 5XX: $ref: '#/components/responses/ServerErrorResponse' + /v1/{prefix}/namespaces/{namespace}/tables/{table}/unregister: + parameters: + - $ref: '#/components/parameters/prefix' + - $ref: '#/components/parameters/namespace' + - $ref: '#/components/parameters/table' + + post: + tags: + - Catalog API + summary: Unregister a table without removing its data or metadata files + operationId: unregisterTable + parameters: + - $ref: '#/components/parameters/idempotency-key' + description: + Unregister a table from the catalog. This is the opposite of + `registerTable`. The table no longer exists in the catalog, but the + underlying data and metadata files are left in place so that the table + can be registered in another catalog. + + + On success, this returns the table's last metadata location and the + corresponding table metadata. This table metadata must include all + commits that happened before the unregister operation. All attempted + commits after the unregister operation in this catalog must fail. + responses: + 200: + $ref: '#/components/responses/UnregisterTableResponse' + 400: + $ref: '#/components/responses/BadRequestErrorResponse' + 401: + $ref: '#/components/responses/UnauthorizedResponse' + 403: + $ref: '#/components/responses/ForbiddenResponse' + 404: + description: + Not Found - NoSuchTableException, table to unregister does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/IcebergErrorResponse' + examples: + TableToUnregisterDoesNotExist: + $ref: '#/components/examples/NoSuchTableError' + 419: + $ref: '#/components/responses/AuthenticationTimeoutResponse' + 503: + $ref: '#/components/responses/ServiceUnavailableResponse' + 5XX: + $ref: '#/components/responses/ServerErrorResponse' + /v1/{prefix}/namespaces/{namespace}/tables/{table}/credentials: parameters: - $ref: '#/components/parameters/prefix' @@ -3792,6 +3842,23 @@ components: type: boolean default: false + UnregisterTableResult: + description: + Last metadata location and the corresponding table metadata for the + table that was successfully unregistered and is no longer tracked by + the catalog. + type: object + required: + - metadata-location + - metadata + properties: + metadata-location: + type: string + description: + The last metadata location for the table at the time it was unregistered. + metadata: + $ref: '#/components/schemas/TableMetadata' + CreateViewRequest: type: object required: @@ -5059,6 +5126,13 @@ components: etag: $ref: '#/components/parameters/etag' + UnregisterTableResponse: + description: Response when a table is successfully unregistered. + content: + application/json: + schema: + $ref: '#/components/schemas/UnregisterTableResult' + LoadViewResponse: description: View metadata result when loading a view content: