Skip to content

Commit 8d52993

Browse files
HonahXFokko
authored andcommitted
remove the new public method
1 parent 363b237 commit 8d52993

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

pyiceberg/catalog/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ def delete_data_files(io: FileIO, manifests_to_delete: List[ManifestFile]) -> No
257257
deleted_files[path] = True
258258

259259

260+
def _property_as_bool(properties: Dict[str, str], property_name: str, default: bool) -> bool:
261+
if value := properties.get(property_name):
262+
return value.lower() == "true"
263+
return default
264+
265+
260266
@dataclass
261267
class PropertiesUpdateSummary:
262268
removed: List[str]

pyiceberg/catalog/glue.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
TABLE_TYPE,
4848
Catalog,
4949
PropertiesUpdateSummary,
50+
_property_as_bool,
5051
)
5152
from pyiceberg.exceptions import (
5253
CommitFailedException,
@@ -62,7 +63,7 @@
6263
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
6364
from pyiceberg.schema import Schema, SchemaVisitor, visit
6465
from pyiceberg.serializers import FromInputFile
65-
from pyiceberg.table import CommitTableRequest, CommitTableResponse, PropertyUtil, Table, update_table_metadata
66+
from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, update_table_metadata
6667
from pyiceberg.table.metadata import TableMetadata, new_table_metadata
6768
from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder
6869
from pyiceberg.typedef import EMPTY_DICT, Identifier, Properties
@@ -313,7 +314,7 @@ def _update_glue_table(self, database_name: str, table_name: str, table_input: T
313314
self.glue.update_table(
314315
DatabaseName=database_name,
315316
TableInput=table_input,
316-
SkipArchive=PropertyUtil.property_as_bool(self.properties, GLUE_SKIP_ARCHIVE, GLUE_SKIP_ARCHIVE_DEFAULT),
317+
SkipArchive=_property_as_bool(self.properties, GLUE_SKIP_ARCHIVE, GLUE_SKIP_ARCHIVE_DEFAULT),
317318
VersionId=version_id,
318319
)
319320
except self.glue.exceptions.EntityNotFoundException as e:

pyiceberg/catalog/hive.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
TABLE_TYPE,
6161
Catalog,
6262
PropertiesUpdateSummary,
63+
_property_as_bool,
6364
)
6465
from pyiceberg.exceptions import (
6566
CommitFailedException,
@@ -74,7 +75,7 @@
7475
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
7576
from pyiceberg.schema import Schema, SchemaVisitor, visit
7677
from pyiceberg.serializers import FromInputFile
77-
from pyiceberg.table import CommitTableRequest, CommitTableResponse, PropertyUtil, Table, TableProperties, update_table_metadata
78+
from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, TableProperties, update_table_metadata
7879
from pyiceberg.table.metadata import new_table_metadata
7980
from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder
8081
from pyiceberg.typedef import EMPTY_DICT, Identifier, Properties
@@ -314,7 +315,7 @@ def create_table(
314315
createTime=current_time_millis // 1000,
315316
lastAccessTime=current_time_millis // 1000,
316317
sd=_construct_hive_storage_descriptor(
317-
schema, location, PropertyUtil.property_as_bool(self.properties, HIVE2_COMPATIBLE, HIVE2_COMPATIBLE_DEFAULT)
318+
schema, location, _property_as_bool(self.properties, HIVE2_COMPATIBLE, HIVE2_COMPATIBLE_DEFAULT)
318319
),
319320
tableType=EXTERNAL_TABLE,
320321
parameters=_construct_parameters(metadata_location),

pyiceberg/table/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,6 @@ def property_as_int(properties: Dict[str, str], property_name: str, default: Opt
223223
else:
224224
return default
225225

226-
@staticmethod
227-
def property_as_bool(properties: Dict[str, str], property_name: str, default: bool) -> bool:
228-
if value := properties.get(property_name):
229-
return value.lower() == "true"
230-
return default
231-
232226

233227
class Transaction:
234228
_table: Table

0 commit comments

Comments
 (0)