Skip to content

Commit

Permalink
Fix integration test for rest catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrluis committed Jan 23, 2025
1 parent a7d4814 commit ae73102
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pyiceberg/table/update/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from abc import ABC, abstractmethod
from datetime import datetime
from functools import singledispatch
from typing import TYPE_CHECKING, Any, Dict, Generic, List, Literal, Optional, Tuple, TypeVar, Union
from typing import TYPE_CHECKING, Any, Dict, Generic, List, Literal, Optional, Tuple, TypeVar, Union, cast

from pydantic import Field, field_validator
from pydantic import Field, field_validator, model_validator
from typing_extensions import Annotated

from pyiceberg.exceptions import CommitFailedException
Expand Down Expand Up @@ -178,6 +178,19 @@ class RemovePropertiesUpdate(IcebergBaseModel):
class SetStatisticsUpdate(IcebergBaseModel):
action: Literal["set-statistics"] = Field(default="set-statistics")
statistics: StatisticsFile
snapshot_id: Optional[int] = Field(
None,
alias="snapshot-id",
description="This optional field is **DEPRECATED for REMOVAL** since it contains redundant information. Clients should use the `statistics.snapshot-id` field instead.",
)

@model_validator(mode="before")
def validate_snapshot_id(cls, data: Dict[str, Any]) -> Dict[str, Any]:
stats = cast(StatisticsFile, data["statistics"])

data["snapshot_id"] = stats.snapshot_id

return data


class RemoveStatisticsUpdate(IcebergBaseModel):
Expand Down

0 comments on commit ae73102

Please sign in to comment.