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 2025/01/15 16:21:30 UTC
(iceberg-python) branch main updated: Add support for lowercase `FileFormat`(#1362)
This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
The following commit(s) were added to refs/heads/main by this push:
new 4e755996 Add support for lowercase `FileFormat`(#1362)
4e755996 is described below
commit 4e755996c11e1768a63d3f3f663bfa77994648b7
Author: hgollakota <43...@users.noreply.github.com>
AuthorDate: Wed Jan 15 11:21:24 2025 -0500
Add support for lowercase `FileFormat`(#1362)
* Added support for lowercase FileFormat
Modified the FileFormat class so that it utilizes EnumMeta value aliases. This allows both "AVRO" and "avro" to map to AVRO.
* Make mypy happy
---------
Co-authored-by: Fokko Driesprong <fo...@apache.org>
---
pyiceberg/manifest.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/pyiceberg/manifest.py b/pyiceberg/manifest.py
index 5a32a633..598d88cd 100644
--- a/pyiceberg/manifest.py
+++ b/pyiceberg/manifest.py
@@ -94,9 +94,16 @@ class ManifestEntryStatus(int, Enum):
class FileFormat(str, Enum):
- AVRO = "AVRO"
- PARQUET = "PARQUET"
- ORC = "ORC"
+ AVRO = "AVRO", "avro"
+ PARQUET = "PARQUET", "parquet"
+ ORC = "ORC", "orc"
+
+ def __new__(cls, value: str, *value_aliases: List[str]) -> "FileFormat":
+ obj = str.__new__(cls)
+ obj._value_ = value
+ for alias in value_aliases:
+ cls._value2member_map_[alias] = obj
+ return obj
@classmethod
def _missing_(cls, value: object) -> Union[None, str]: