158158from pyiceberg .utils .config import Config
159159from pyiceberg .utils .datetime import millis_to_datetime
160160from pyiceberg .utils .deprecated import deprecated
161+ from pyiceberg .utils .properties import get_first_property_value , property_as_int
161162from pyiceberg .utils .singleton import Singleton
162163from pyiceberg .utils .truncate import truncate_upper_bound_binary_string , truncate_upper_bound_text_string
163164
@@ -345,14 +346,12 @@ def _initialize_fs(self, scheme: str, netloc: Optional[str] = None) -> FileSyste
345346 if scheme in {"s3" , "s3a" , "s3n" }:
346347 from pyarrow .fs import S3FileSystem
347348
348- from pyiceberg .table import PropertyUtil
349-
350349 client_kwargs : Dict [str , Any ] = {
351350 "endpoint_override" : self .properties .get (S3_ENDPOINT ),
352- "access_key" : PropertyUtil . get_first_property_value (self .properties , S3_ACCESS_KEY_ID , AWS_ACCESS_KEY_ID ),
353- "secret_key" : PropertyUtil . get_first_property_value (self .properties , S3_SECRET_ACCESS_KEY , AWS_SECRET_ACCESS_KEY ),
354- "session_token" : PropertyUtil . get_first_property_value (self .properties , S3_SESSION_TOKEN , AWS_SESSION_TOKEN ),
355- "region" : PropertyUtil . get_first_property_value (self .properties , S3_REGION , AWS_REGION ),
351+ "access_key" : get_first_property_value (self .properties , S3_ACCESS_KEY_ID , AWS_ACCESS_KEY_ID ),
352+ "secret_key" : get_first_property_value (self .properties , S3_SECRET_ACCESS_KEY , AWS_SECRET_ACCESS_KEY ),
353+ "session_token" : get_first_property_value (self .properties , S3_SESSION_TOKEN , AWS_SESSION_TOKEN ),
354+ "region" : get_first_property_value (self .properties , S3_REGION , AWS_REGION ),
356355 }
357356
358357 if proxy_uri := self .properties .get (S3_PROXY_URI ):
@@ -2132,10 +2131,10 @@ def data_file_statistics_from_parquet_metadata(
21322131
21332132
21342133def write_file (io : FileIO , table_metadata : TableMetadata , tasks : Iterator [WriteTask ]) -> Iterator [DataFile ]:
2135- from pyiceberg .table import DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE , PropertyUtil , TableProperties
2134+ from pyiceberg .table import DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE , TableProperties
21362135
21372136 parquet_writer_kwargs = _get_parquet_writer_kwargs (table_metadata .properties )
2138- row_group_size = PropertyUtil . property_as_int (
2137+ row_group_size = property_as_int (
21392138 properties = table_metadata .properties ,
21402139 property_name = TableProperties .PARQUET_ROW_GROUP_SIZE_BYTES ,
21412140 default = TableProperties .PARQUET_ROW_GROUP_SIZE_BYTES_DEFAULT ,
@@ -2278,7 +2277,7 @@ def parquet_files_to_data_files(io: FileIO, table_metadata: TableMetadata, file_
22782277
22792278
22802279def _get_parquet_writer_kwargs (table_properties : Properties ) -> Dict [str , Any ]:
2281- from pyiceberg .table import PropertyUtil , TableProperties
2280+ from pyiceberg .table import TableProperties
22822281
22832282 for key_pattern in [
22842283 TableProperties .PARQUET_ROW_GROUP_SIZE_BYTES ,
@@ -2290,7 +2289,7 @@ def _get_parquet_writer_kwargs(table_properties: Properties) -> Dict[str, Any]:
22902289 raise NotImplementedError (f"Parquet writer option(s) { unsupported_keys } not implemented" )
22912290
22922291 compression_codec = table_properties .get (TableProperties .PARQUET_COMPRESSION , TableProperties .PARQUET_COMPRESSION_DEFAULT )
2293- compression_level = PropertyUtil . property_as_int (
2292+ compression_level = property_as_int (
22942293 properties = table_properties ,
22952294 property_name = TableProperties .PARQUET_COMPRESSION_LEVEL ,
22962295 default = TableProperties .PARQUET_COMPRESSION_LEVEL_DEFAULT ,
@@ -2301,17 +2300,17 @@ def _get_parquet_writer_kwargs(table_properties: Properties) -> Dict[str, Any]:
23012300 return {
23022301 "compression" : compression_codec ,
23032302 "compression_level" : compression_level ,
2304- "data_page_size" : PropertyUtil . property_as_int (
2303+ "data_page_size" : property_as_int (
23052304 properties = table_properties ,
23062305 property_name = TableProperties .PARQUET_PAGE_SIZE_BYTES ,
23072306 default = TableProperties .PARQUET_PAGE_SIZE_BYTES_DEFAULT ,
23082307 ),
2309- "dictionary_pagesize_limit" : PropertyUtil . property_as_int (
2308+ "dictionary_pagesize_limit" : property_as_int (
23102309 properties = table_properties ,
23112310 property_name = TableProperties .PARQUET_DICT_SIZE_BYTES ,
23122311 default = TableProperties .PARQUET_DICT_SIZE_BYTES_DEFAULT ,
23132312 ),
2314- "write_batch_size" : PropertyUtil . property_as_int (
2313+ "write_batch_size" : property_as_int (
23152314 properties = table_properties ,
23162315 property_name = TableProperties .PARQUET_PAGE_ROW_LIMIT ,
23172316 default = TableProperties .PARQUET_PAGE_ROW_LIMIT_DEFAULT ,
@@ -2331,11 +2330,11 @@ def _dataframe_to_data_files(
23312330 Returns:
23322331 An iterable that supplies datafiles that represent the table.
23332332 """
2334- from pyiceberg .table import DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE , PropertyUtil , TableProperties , WriteTask
2333+ from pyiceberg .table import DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE , TableProperties , WriteTask
23352334
23362335 counter = counter or itertools .count (0 )
23372336 write_uuid = write_uuid or uuid .uuid4 ()
2338- target_file_size : int = PropertyUtil . property_as_int ( # type: ignore # The property is set with non-None value.
2337+ target_file_size : int = property_as_int ( # type: ignore # The property is set with non-None value.
23392338 properties = table_metadata .properties ,
23402339 property_name = TableProperties .WRITE_TARGET_FILE_SIZE_BYTES ,
23412340 default = TableProperties .WRITE_TARGET_FILE_SIZE_BYTES_DEFAULT ,
0 commit comments