From bf22f49f68c884bc3a556d2939db9fb382f8ceeb Mon Sep 17 00:00:00 2001 From: Hongyue Zhang Date: Wed, 12 Feb 2025 14:33:28 -0800 Subject: [PATCH 1/5] OpenAPI: Add optional overwrite when registering table --- open-api/rest-catalog-open-api.py | 3 +++ open-api/rest-catalog-open-api.yaml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/open-api/rest-catalog-open-api.py b/open-api/rest-catalog-open-api.py index 9cae07dd106e..f99c4bf55709 100644 --- a/open-api/rest-catalog-open-api.py +++ b/open-api/rest-catalog-open-api.py @@ -502,6 +502,9 @@ class PlanStatus(BaseModel): class RegisterTableRequest(BaseModel): name: str metadata_location: str = Field(..., alias='metadata-location') + overwriteRequested: Optional[bool] = Field( + False, description='Whether to overwrite table metadata if table already exists' + ) class TokenType(BaseModel): diff --git a/open-api/rest-catalog-open-api.yaml b/open-api/rest-catalog-open-api.yaml index 4b82fb3a3b0e..e01afaba3eef 100644 --- a/open-api/rest-catalog-open-api.yaml +++ b/open-api/rest-catalog-open-api.yaml @@ -3463,6 +3463,10 @@ components: type: string metadata-location: type: string + overwriteRequested: + description: Whether to overwrite table metadata if table already exists + type: boolean + default: false CreateViewRequest: type: object From a42b92d1aae51f6509e3ef14fd860daf4875dd8e Mon Sep 17 00:00:00 2001 From: Hongyue Zhang Date: Wed, 12 Feb 2025 16:37:59 -0800 Subject: [PATCH 2/5] simplify to overwrite --- open-api/rest-catalog-open-api.py | 2 +- open-api/rest-catalog-open-api.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/open-api/rest-catalog-open-api.py b/open-api/rest-catalog-open-api.py index f99c4bf55709..0da0897372fd 100644 --- a/open-api/rest-catalog-open-api.py +++ b/open-api/rest-catalog-open-api.py @@ -502,7 +502,7 @@ class PlanStatus(BaseModel): class RegisterTableRequest(BaseModel): name: str metadata_location: str = Field(..., alias='metadata-location') - overwriteRequested: Optional[bool] = Field( + overwrite: Optional[bool] = Field( False, description='Whether to overwrite table metadata if table already exists' ) diff --git a/open-api/rest-catalog-open-api.yaml b/open-api/rest-catalog-open-api.yaml index e01afaba3eef..9138e796a42f 100644 --- a/open-api/rest-catalog-open-api.yaml +++ b/open-api/rest-catalog-open-api.yaml @@ -3463,7 +3463,7 @@ components: type: string metadata-location: type: string - overwriteRequested: + overwrite: description: Whether to overwrite table metadata if table already exists type: boolean default: false From 231148be65825a75724fae5652fef5473885b4a1 Mon Sep 17 00:00:00 2001 From: Hongyue/Steve Zhang Date: Fri, 14 Feb 2025 21:05:27 -0800 Subject: [PATCH 3/5] Add the article to the description Co-authored-by: Eduard Tudenhoefner --- open-api/rest-catalog-open-api.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/open-api/rest-catalog-open-api.yaml b/open-api/rest-catalog-open-api.yaml index 9138e796a42f..313413b1654e 100644 --- a/open-api/rest-catalog-open-api.yaml +++ b/open-api/rest-catalog-open-api.yaml @@ -3464,7 +3464,7 @@ components: metadata-location: type: string overwrite: - description: Whether to overwrite table metadata if table already exists + description: Whether to overwrite table metadata if the table already exists type: boolean default: false From 1f216a862aef4ae6d43e8f047c624c4665999501 Mon Sep 17 00:00:00 2001 From: Hongyue Zhang Date: Fri, 14 Feb 2025 21:06:56 -0800 Subject: [PATCH 4/5] Update generated python as well Signed-off-by: Hongyue Zhang --- open-api/rest-catalog-open-api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/open-api/rest-catalog-open-api.py b/open-api/rest-catalog-open-api.py index 0da0897372fd..8eca7434b909 100644 --- a/open-api/rest-catalog-open-api.py +++ b/open-api/rest-catalog-open-api.py @@ -18,11 +18,10 @@ from __future__ import annotations from datetime import date +from pydantic import BaseModel, Extra, Field from typing import Any, Dict, List, Literal, Optional, Union from uuid import UUID -from pydantic import BaseModel, Extra, Field - class ErrorModel(BaseModel): """ @@ -503,7 +502,8 @@ class RegisterTableRequest(BaseModel): name: str metadata_location: str = Field(..., alias='metadata-location') overwrite: Optional[bool] = Field( - False, description='Whether to overwrite table metadata if table already exists' + False, + description='Whether to overwrite table metadata if the table already exists', ) From ec94d25d2e8dbec936769d2c5ca2a9e843201641 Mon Sep 17 00:00:00 2001 From: Hongyue Zhang Date: Fri, 14 Feb 2025 21:15:04 -0800 Subject: [PATCH 5/5] Fix import order --- open-api/rest-catalog-open-api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/open-api/rest-catalog-open-api.py b/open-api/rest-catalog-open-api.py index 8eca7434b909..458b2fa56bc9 100644 --- a/open-api/rest-catalog-open-api.py +++ b/open-api/rest-catalog-open-api.py @@ -18,10 +18,11 @@ from __future__ import annotations from datetime import date -from pydantic import BaseModel, Extra, Field from typing import Any, Dict, List, Literal, Optional, Union from uuid import UUID +from pydantic import BaseModel, Extra, Field + class ErrorModel(BaseModel): """