3333from __future__ import annotations
3434
3535import re
36- from enum import IntEnum
3736from functools import cached_property
3837from typing import (
3938 Any ,
5453from pydantic_core .core_schema import ValidatorFunctionWrapHandler
5554
5655from pyiceberg .exceptions import ValidationError
57- from pyiceberg .typedef import IcebergBaseModel , IcebergRootModel , L
56+ from pyiceberg .typedef import IcebergBaseModel , IcebergRootModel , L , TableVersion
5857from pyiceberg .utils .parsing import ParseNumberFromBrackets
5958from pyiceberg .utils .singleton import Singleton
6059
6362FIXED_PARSER = ParseNumberFromBrackets (FIXED )
6463
6564
66- class TableVersion (IntEnum ):
67- ONE = 1
68- TWO = 2
69- THREE = 3
70-
71-
7265def transform_dict_value_to_str (dict : Dict [str , Any ]) -> Dict [str , str ]:
7366 """Transform all values in the dictionary to string. Raise an error if any value is None."""
7467 for key , value in dict .items ():
@@ -190,7 +183,7 @@ def is_struct(self) -> bool:
190183
191184 def minimum_format_version (self ) -> TableVersion :
192185 """Minimum Iceberg format version after which this type is supported."""
193- return TableVersion . ONE
186+ return 1
194187
195188
196189class PrimitiveType (Singleton , IcebergRootModel [str ], IcebergType ):
@@ -734,7 +727,7 @@ class TimestampNanoType(PrimitiveType):
734727 root : Literal ["timestamp_ns" ] = Field (default = "timestamp_ns" )
735728
736729 def minimum_format_version (self ) -> TableVersion :
737- return TableVersion . THREE
730+ return 3
738731
739732
740733class TimestamptzNanoType (PrimitiveType ):
@@ -753,7 +746,7 @@ class TimestamptzNanoType(PrimitiveType):
753746 root : Literal ["timestamptz_ns" ] = Field (default = "timestamptz_ns" )
754747
755748 def minimum_format_version (self ) -> TableVersion :
756- return TableVersion . THREE
749+ return 3
757750
758751
759752class StringType (PrimitiveType ):
@@ -820,4 +813,4 @@ class UnknownType(PrimitiveType):
820813 root : Literal ["unknown" ] = Field (default = "unknown" )
821814
822815 def minimum_format_version (self ) -> TableVersion :
823- return TableVersion . THREE
816+ return 3
0 commit comments