|
90 | 90 | create_mapping_from_schema, |
91 | 91 | parse_mapping_from_json, |
92 | 92 | ) |
93 | | -from pyiceberg.table.refs import MAIN_BRANCH, SnapshotRef |
| 93 | +from pyiceberg.table.refs import MAIN_BRANCH, SnapshotRef, SnapshotRefType |
94 | 94 | from pyiceberg.table.snapshots import ( |
95 | 95 | Operation, |
96 | 96 | Snapshot, |
@@ -391,7 +391,7 @@ class AddSnapshotUpdate(TableUpdate): |
391 | 391 | class SetSnapshotRefUpdate(TableUpdate): |
392 | 392 | action: TableUpdateAction = TableUpdateAction.set_snapshot_ref |
393 | 393 | ref_name: str = Field(alias="ref-name") |
394 | | - type: Literal["tag", "branch"] |
| 394 | + type: Literal[SnapshotRefType.TAG, SnapshotRefType.BRANCH] |
395 | 395 | snapshot_id: int = Field(alias="snapshot-id") |
396 | 396 | max_ref_age_ms: Annotated[Optional[int], Field(alias="max-ref-age-ms", default=None)] |
397 | 397 | max_snapshot_age_ms: Annotated[Optional[int], Field(alias="max-snapshot-age-ms", default=None)] |
@@ -2445,7 +2445,10 @@ def commit(self) -> Snapshot: |
2445 | 2445 | with self._table.transaction() as tx: |
2446 | 2446 | tx.add_snapshot(snapshot=snapshot) |
2447 | 2447 | tx.set_ref_snapshot( |
2448 | | - snapshot_id=self._snapshot_id, parent_snapshot_id=self._parent_snapshot_id, ref_name=MAIN_BRANCH, type="branch" |
| 2448 | + snapshot_id=self._snapshot_id, |
| 2449 | + parent_snapshot_id=self._parent_snapshot_id, |
| 2450 | + ref_name=MAIN_BRANCH, |
| 2451 | + type=SnapshotRefType.BRANCH, |
2449 | 2452 | ) |
2450 | 2453 |
|
2451 | 2454 | return snapshot |
0 commit comments