Skip to content

Commit a813a92

Browse files
Make replace_table_transaction @AbstractMethod on Catalog
Matches PR #498 (create_table_transaction) precedent. NoopCatalog gets an explicit stub since it extends Catalog directly.
1 parent 1efa6fe commit a813a92

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

pyiceberg/catalog/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,12 @@ def replace_table(
479479
480480
Raises:
481481
NoSuchTableError: If the table does not exist.
482-
TableAlreadyExistsError: If a view exists at the same identifier.
483482
"""
484483
return self.replace_table_transaction(
485484
identifier, schema, location, partition_spec, sort_order, properties
486485
).commit_transaction()
487486

487+
@abstractmethod
488488
def replace_table_transaction(
489489
self,
490490
identifier: str | Identifier,
@@ -515,9 +515,7 @@ def replace_table_transaction(
515515
516516
Raises:
517517
NoSuchTableError: If the table does not exist.
518-
TableAlreadyExistsError: If a view exists at the same identifier.
519518
"""
520-
raise NotImplementedError("replace_table_transaction is not supported for this catalog type")
521519

522520
def _replace_staged_table(
523521
self,

pyiceberg/catalog/noop.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from pyiceberg.table import (
2929
CommitTableResponse,
3030
CreateTableTransaction,
31+
ReplaceTableTransaction,
3132
Table,
3233
)
3334
from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder
@@ -68,6 +69,18 @@ def create_table_transaction(
6869
) -> CreateTableTransaction:
6970
raise NotImplementedError
7071

72+
@override
73+
def replace_table_transaction(
74+
self,
75+
identifier: str | Identifier,
76+
schema: Schema | pa.Schema,
77+
location: str | None = None,
78+
partition_spec: PartitionSpec = UNPARTITIONED_PARTITION_SPEC,
79+
sort_order: SortOrder = UNSORTED_SORT_ORDER,
80+
properties: Properties = EMPTY_DICT,
81+
) -> ReplaceTableTransaction:
82+
raise NotImplementedError
83+
7184
@override
7285
def load_table(self, identifier: str | Identifier) -> Table:
7386
raise NotImplementedError

0 commit comments

Comments
 (0)