Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 254 additions & 0 deletions open-api/rest-catalog-open-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,14 @@ class EnableRowLineageUpdate(BaseUpdate):
action: str = Field('enable-row-lineage', const=True)


class CustomOperationType(BaseModel):
__root__: str = Field(
...,
description="Custom operation type for catalog-specific extensions. Must start with 'x-' followed by an implementation-specific identifier.\n",
regex='^x-[a-zA-Z0-9-_.]+$',
)


class TableRequirement(BaseModel):
type: str

Expand Down Expand Up @@ -504,6 +512,23 @@ class PlanStatus(BaseModel):
)


class NamespaceReference(BaseModel):
reference_type: str = Field('namespace', alias='reference-type', const=True)
namespace: Namespace


class TableReference(BaseModel):
reference_type: str = Field('table', alias='reference-type', const=True)
identifier: TableIdentifier
table_uuid: UUID = Field(..., alias='table-uuid')


class ViewReference(BaseModel):
reference_type: str = Field('view', alias='reference-type', const=True)
identifier: TableIdentifier
view_uuid: UUID = Field(..., alias='view-uuid')


class RegisterTableRequest(BaseModel):
name: str
metadata_location: str = Field(..., alias='metadata-location')
Expand Down Expand Up @@ -699,6 +724,36 @@ class UpdateNamespacePropertiesResponse(BaseModel):
)


class CustomOperation(BaseModel):
"""
Extension point for catalog-specific operations not defined in the standard.

"""

class Config:
extra = Extra.allow

operation_type: Literal['custom'] = Field(..., alias='operation-type', const=True)
custom_type: CustomOperationType = Field(..., alias='custom-type')
identifier: Optional[TableIdentifier] = Field(
None,
description='Table or view identifier this operation applies to, if applicable',
)
namespace: Optional[Namespace] = Field(
None, description='Namespace this operation applies to, if applicable'
)
table_uuid: Optional[UUID] = Field(
None,
alias='table-uuid',
description='UUID of table this operation applies to, if applicable',
)
view_uuid: Optional[UUID] = Field(
None,
alias='view-uuid',
description='UUID of view this operation applies to, if applicable',
)


class BlobMetadata(BaseModel):
type: str
snapshot_id: int = Field(..., alias='snapshot-id')
Expand Down Expand Up @@ -941,6 +996,29 @@ class SetPartitionStatisticsUpdate(BaseUpdate):
)


class OperationType(BaseModel):
__root__: Union[
Literal[
'create-table',
'register-table',
'drop-table',
'update-table',
'rename-table',
'create-view',
'drop-view',
'replace-view',
'rename-view',
'create-namespace',
'update-namespace-properties',
'drop-namespace',
],
CustomOperationType,
] = Field(
...,
description='Defines the type of operation, either a standard operation defined by the Iceberg REST API specification or a custom operation specific to an implementation. This enum is extended in future versions of the REST specification. Clients should ignore unknown operation types.\n',
)


class ViewRequirement(BaseModel):
__root__: AssertViewUUID = Field(..., discriminator='type')

Expand Down Expand Up @@ -968,10 +1046,86 @@ class EmptyPlanningResult(BaseModel):
status: Literal['cancelled']


class GetEventsRequest(BaseModel):
next_page_token: Optional[PageToken] = Field(None, alias='next-page-token')
page_size: Optional[int] = Field(
None,
alias='page-size',
description='The maximum number of events to return in a single response. If not provided, the server may choose a default page size.\n',
)
after_timestamp_ms: Optional[int] = Field(
None,
alias='after-timestamp-ms',
description='The (server) timestamp in milliseconds to start consuming events from (inclusive). If not provided, the first available timestamp is used.\n',
)
operation_types: Optional[List[OperationType]] = Field(
None,
alias='operation-types',
description='Filter events by the type of operation. If not provided, all types are returned.\n',
)
catalog_objects: Optional[
List[Union[NamespaceReference, TableReference, ViewReference]]
] = Field(
None,
alias='catalog-objects',
description='List of catalog objects (namespaces, tables, views) to get events for. If not provided, events for all objects will be returned subject to other filters. For specified namespaces, events for the namespaces and all containing objects (namespaces, tables, views) will be returned.\n',
discriminator='reference_type',
)
custom_filters: Optional[Dict[str, Any]] = Field(
None,
alias='custom-filters',
description='Implementation-specific filter extensions. Implementations may define custom filter properties beyond the standard ones defined in this specification.\n',
)


class ReportMetricsRequest2(CommitReport):
report_type: str = Field(..., alias='report-type')


class DropTableOperation(BaseModel):
operation_type: Literal['drop-table'] = Field(
..., alias='operation-type', const=True
)
identifier: TableIdentifier
table_uuid: UUID = Field(..., alias='table-uuid')
purge: Optional[bool] = Field(None, description='Whether purge flag was set')


class RenameTableOperation(RenameTableRequest):
operation_type: Literal['rename-table', 'rename-view'] = Field(
..., alias='operation-type', const=True
)
table_uuid: UUID = Field(..., alias='table-uuid')


class DropViewOperation(BaseModel):
operation_type: Literal['drop-view'] = Field(
..., alias='operation-type', const=True
)
identifier: TableIdentifier
view_uuid: UUID = Field(..., alias='view-uuid')


class CreateNamespaceOperation(CreateNamespaceResponse):
operation_type: Literal['create-namespace'] = Field(
..., alias='operation-type', const=True
)


class UpdateNamespacePropertiesOperation(UpdateNamespacePropertiesResponse):
operation_type: Literal['update-namespace-properties'] = Field(
..., alias='operation-type', const=True
)
namespace: Namespace


class DropNamespaceOperation(BaseModel):
operation_type: Literal['drop-namespace'] = Field(
..., alias='operation-type', const=True
)
namespace: Namespace


class StatisticsFile(BaseModel):
snapshot_id: int = Field(..., alias='snapshot-id')
statistics_path: str = Field(..., alias='statistics-path')
Expand Down Expand Up @@ -1389,6 +1543,104 @@ class CommitTableResponse(BaseModel):
metadata: TableMetadata


class EventsResponse(BaseModel):
next_page_token: Optional[PageToken] = Field(None, alias='next-page-token')
highest_processed_timestamp_ms: int = Field(
...,
alias='highest-processed-timestamp-ms',
description='The highest timestamp processed by the server when generating this response. This may not necessarily appear in the returned changes if it was filtered out.\nClients can use this value as the `after-timestamp-ms` parameter in subsequent requests to continue retrieving changes after this point.\n',
)
events: List[Event]


class Event(BaseModel):
event_id: str = Field(
...,
alias='event-id',
description='Unique ID of this event. Clients should perform deduplication based on this ID.',
)
request_id: str = Field(
..., alias='request-id', description='ID of the request this change belongs to.'
)
event_count: int = Field(
...,
alias='event-count',
description='Number of events in the request / batch of events',
)
timestamp_ms: int = Field(
...,
alias='timestamp-ms',
description='Timestamp when this transaction occurred (epoch milliseconds). Timestamps are not guaranteed to be unique. Typically all events in a transaction will have the same timestamp.\n',
)
actor: Optional[str] = Field(
None,
description='The actor who performed the operation, such as a user or service account. The content of this field is implementation specific.\n',
)
operation: Union[
CreateTableOperation,
RegisterTableOperation,
DropTableOperation,
UpdateTableOperation,
RenameTableOperation,
CreateViewOperation,
DropViewOperation,
ReplaceViewOperation,
CreateNamespaceOperation,
UpdateNamespacePropertiesOperation,
DropNamespaceOperation,
CustomOperation,
] = Field(
...,
description='The operation that was performed, such as creating or updating a table. Clients should discard events with unknown operation types.\n',
discriminator='operation_type',
)


class CreateTableOperation(BaseModel):
operation_type: Literal['create-table'] = Field(
..., alias='operation-type', const=True
)
identifier: TableIdentifier
table_uuid: UUID = Field(..., alias='table-uuid')
metadata: TableMetadata


class RegisterTableOperation(BaseModel):
operation_type: Literal['register-table'] = Field(
..., alias='operation-type', const=True
)
identifier: TableIdentifier
table_uuid: UUID = Field(..., alias='table-uuid')
metadata: TableMetadata
Comment thread
c-thiel marked this conversation as resolved.
Outdated


class UpdateTableOperation(BaseModel):
operation_type: Literal['update-table'] = Field(
..., alias='operation-type', const=True
)
identifier: TableIdentifier
table_uuid: UUID = Field(..., alias='table-uuid')
updates: List[TableUpdate]


class CreateViewOperation(BaseModel):
operation_type: Literal['create-view'] = Field(
..., alias='operation-type', const=True
)
identifier: TableIdentifier
view_uuid: UUID = Field(..., alias='view-uuid')
metadata: ViewMetadata


class ReplaceViewOperation(BaseModel):
operation_type: Literal['replace-view'] = Field(
..., alias='operation-type', const=True
)
identifier: TableIdentifier
view_uuid: UUID = Field(..., alias='view-uuid')
updates: List[ViewUpdate]


class PlanTableScanRequest(BaseModel):
snapshot_id: Optional[int] = Field(
None,
Expand Down Expand Up @@ -1487,6 +1739,8 @@ class CompletedPlanningWithIDResult(CompletedPlanningResult):
CreateTableRequest.update_forward_refs()
CreateViewRequest.update_forward_refs()
ReportMetricsRequest.update_forward_refs()
EventsResponse.update_forward_refs()
Event.update_forward_refs()
CompletedPlanningResult.update_forward_refs()
FetchScanTasksResult.update_forward_refs()
CompletedPlanningWithIDResult.update_forward_refs()
Loading