Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nastra committed Oct 18, 2023
1 parent b518ab2 commit 380c465
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ private View replace(LoadViewResponse response) {
request,
LoadViewResponse.class,
headers(context),
ErrorHandlers.viewErrorHandler());
ErrorHandlers.viewCommitHandler());

return viewFromResponse(viewResponse);
}
Expand Down
10 changes: 8 additions & 2 deletions open-api/rest-catalog-open-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,13 +666,14 @@ class TableMetadata(BaseModel):


class ViewMetadata(BaseModel):
view_uuid: str = Field(..., alias='view-uuid')
format_version: int = Field(..., alias='format-version', ge=1, le=1)
location: str
current_version_id: int = Field(..., alias='current-version-id')
versions: List[ViewVersion]
version_log: List[ViewHistoryEntry] = Field(..., alias='version-log')
schemas: List[Schema]
properties: Dict[str, str]
properties: Optional[Dict[str, str]] = None


class AddSchemaUpdate(BaseUpdate):
Expand Down Expand Up @@ -706,6 +707,7 @@ class TableUpdate(BaseModel):

class ViewUpdate(BaseModel):
__root__: Union[
AssignUUIDUpdate,
UpgradeFormatVersionUpdate,
AddSchemaUpdate,
SetLocationUpdate,
Expand Down Expand Up @@ -786,7 +788,10 @@ class CreateTableRequest(BaseModel):

class CreateViewRequest(BaseModel):
name: str
metadata: ViewMetadata
location: Optional[str] = None
schema_: Schema = Field(..., alias='schema')
view_version: ViewVersion = Field(..., alias='view-version')
properties: Dict[str, str]


class LoadViewResult(BaseModel):
Expand Down Expand Up @@ -863,4 +868,5 @@ class ReportMetricsRequest(ScanReport):
ViewMetadata.update_forward_refs()
AddSchemaUpdate.update_forward_refs()
CreateTableRequest.update_forward_refs()
CreateViewRequest.update_forward_refs()
ReportMetricsRequest2.update_forward_refs()
29 changes: 21 additions & 8 deletions open-api/rest-catalog-open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ paths:
406:
$ref: '#/components/responses/UnsupportedOperationResponse'
409:
description: Conflict - The target table identifier to rename to already exists
description: Conflict - The target identifier to rename to already exists as a table or view
content:
application/json:
schema:
Expand Down Expand Up @@ -1153,7 +1153,7 @@ paths:
Load a view from the catalog.


The response contains both configuration and table metadata. The configuration, if non-empty is used
The response contains both configuration and view metadata. The configuration, if non-empty is used
as additional configuration for the view that overrides catalog configuration. For example, this
configuration may change the FileIO implementation to be used for the view.

Expand Down Expand Up @@ -1380,7 +1380,7 @@ paths:
description:
Not Found
- NoSuchViewException, view to rename does not exist
- NoSuchNamespaceException, The target namespace of the new table identifier does not exist
- NoSuchNamespaceException, The target namespace of the new identifier does not exist
content:
application/json:
schema:
Expand All @@ -1393,7 +1393,7 @@ paths:
406:
$ref: '#/components/responses/UnsupportedOperationResponse'
409:
description: Conflict - The target view identifier to rename to already exists
description: Conflict - The target identifier to rename to already exists as a table or view
content:
application/json:
schema:
Expand Down Expand Up @@ -2094,14 +2094,16 @@ components:
ViewMetadata:
type: object
required:
- view-uuid
- format-version
- location
- current-version-id
- versions
- version-log
- schemas
- properties
properties:
view-uuid:
type: string
format-version:
type: integer
minimum: 1
Expand Down Expand Up @@ -2358,6 +2360,7 @@ components:

ViewUpdate:
anyOf:
- $ref: '#/components/schemas/AssignUUIDUpdate'
- $ref: '#/components/schemas/UpgradeFormatVersionUpdate'
- $ref: '#/components/schemas/AddSchemaUpdate'
- $ref: '#/components/schemas/SetLocationUpdate'
Expand Down Expand Up @@ -2538,12 +2541,22 @@ components:
type: object
required:
- name
- metadata
- schema
- view-version
- properties
properties:
name:
type: string
metadata:
$ref: '#/components/schemas/ViewMetadata'
location:
type: string
schema:
$ref: '#/components/schemas/Schema'
view-version:
$ref: '#/components/schemas/ViewVersion'
properties:
type: object
additionalProperties:
type: string

LoadViewResult:
description: |
Expand Down

0 comments on commit 380c465

Please sign in to comment.