You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by fo...@apache.org on 2024/04/14 04:49:10 UTC
(iceberg-python) 05/05: remove the new public method
This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch pyiceberg-0.6.x
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
commit 8d52993deb78cfd936a6882fe407f299c80d006d
Author: HonahX <ho...@apache.org>
AuthorDate: Sat Apr 13 16:06:08 2024 -0700
remove the new public method
---
pyiceberg/catalog/__init__.py | 6 ++++++
pyiceberg/catalog/glue.py | 5 +++--
pyiceberg/catalog/hive.py | 5 +++--
pyiceberg/table/__init__.py | 6 ------
4 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/pyiceberg/catalog/__init__.py b/pyiceberg/catalog/__init__.py
index e14b4c94..d12f8be4 100644
--- a/pyiceberg/catalog/__init__.py
+++ b/pyiceberg/catalog/__init__.py
@@ -257,6 +257,12 @@ def delete_data_files(io: FileIO, manifests_to_delete: List[ManifestFile]) -> No
deleted_files[path] = True
+def _property_as_bool(properties: Dict[str, str], property_name: str, default: bool) -> bool:
+ if value := properties.get(property_name):
+ return value.lower() == "true"
+ return default
+
+
@dataclass
class PropertiesUpdateSummary:
removed: List[str]
diff --git a/pyiceberg/catalog/glue.py b/pyiceberg/catalog/glue.py
index 291c0667..2d30333b 100644
--- a/pyiceberg/catalog/glue.py
+++ b/pyiceberg/catalog/glue.py
@@ -47,6 +47,7 @@ from pyiceberg.catalog import (
TABLE_TYPE,
Catalog,
PropertiesUpdateSummary,
+ _property_as_bool,
)
from pyiceberg.exceptions import (
CommitFailedException,
@@ -62,7 +63,7 @@ from pyiceberg.io import load_file_io
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
from pyiceberg.schema import Schema, SchemaVisitor, visit
from pyiceberg.serializers import FromInputFile
-from pyiceberg.table import CommitTableRequest, CommitTableResponse, PropertyUtil, Table, update_table_metadata
+from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, update_table_metadata
from pyiceberg.table.metadata import TableMetadata, new_table_metadata
from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder
from pyiceberg.typedef import EMPTY_DICT, Identifier, Properties
@@ -313,7 +314,7 @@ class GlueCatalog(Catalog):
self.glue.update_table(
DatabaseName=database_name,
TableInput=table_input,
- SkipArchive=PropertyUtil.property_as_bool(self.properties, GLUE_SKIP_ARCHIVE, GLUE_SKIP_ARCHIVE_DEFAULT),
+ SkipArchive=_property_as_bool(self.properties, GLUE_SKIP_ARCHIVE, GLUE_SKIP_ARCHIVE_DEFAULT),
VersionId=version_id,
)
except self.glue.exceptions.EntityNotFoundException as e:
diff --git a/pyiceberg/catalog/hive.py b/pyiceberg/catalog/hive.py
index d97ddd80..f5436264 100644
--- a/pyiceberg/catalog/hive.py
+++ b/pyiceberg/catalog/hive.py
@@ -60,6 +60,7 @@ from pyiceberg.catalog import (
TABLE_TYPE,
Catalog,
PropertiesUpdateSummary,
+ _property_as_bool,
)
from pyiceberg.exceptions import (
CommitFailedException,
@@ -74,7 +75,7 @@ from pyiceberg.io import FileIO, load_file_io
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
from pyiceberg.schema import Schema, SchemaVisitor, visit
from pyiceberg.serializers import FromInputFile
-from pyiceberg.table import CommitTableRequest, CommitTableResponse, PropertyUtil, Table, TableProperties, update_table_metadata
+from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table, TableProperties, update_table_metadata
from pyiceberg.table.metadata import new_table_metadata
from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder
from pyiceberg.typedef import EMPTY_DICT, Identifier, Properties
@@ -314,7 +315,7 @@ class HiveCatalog(Catalog):
createTime=current_time_millis // 1000,
lastAccessTime=current_time_millis // 1000,
sd=_construct_hive_storage_descriptor(
- schema, location, PropertyUtil.property_as_bool(self.properties, HIVE2_COMPATIBLE, HIVE2_COMPATIBLE_DEFAULT)
+ schema, location, _property_as_bool(self.properties, HIVE2_COMPATIBLE, HIVE2_COMPATIBLE_DEFAULT)
),
tableType=EXTERNAL_TABLE,
parameters=_construct_parameters(metadata_location),
diff --git a/pyiceberg/table/__init__.py b/pyiceberg/table/__init__.py
index c2d5409b..0f4e334d 100644
--- a/pyiceberg/table/__init__.py
+++ b/pyiceberg/table/__init__.py
@@ -223,12 +223,6 @@ class PropertyUtil:
else:
return default
- @staticmethod
- def property_as_bool(properties: Dict[str, str], property_name: str, default: bool) -> bool:
- if value := properties.get(property_name):
- return value.lower() == "true"
- return default
-
class Transaction:
_table: Table