pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/apache/iceberg-python/commit/8bfb16cf063d121a177d43fec01620e1a5e6d84a

igin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-9c8f61f9f58ad7b2.css" /> fix loading `in-memory` catalog (#1725) · apache/iceberg-python@8bfb16c · GitHub
Skip to content

Commit 8bfb16c

Browse files
authored
fix loading in-memory catalog (#1725)
Previously `CatalogType` was fetched by key, `CatalogType[provided_catalog_type.upper()]` (note the bracket) This PR changes `CatalogType` to be fetched by value, `CatalogType(provided_catalog_type.lower())` (note the parenthesis) https://stackoverflow.com/questions/29799235/python-enum-value2member-map-accessor This fix loading `in-memory` catalog, `load_catalog("catalog", **{"type": "in-memory"})`. Previously, `"in-memory"` caused a key error because its key is `IN_MEMORY`. Note the `-` vs `_`. https://github.com/apache/iceberg-python/blob/1d24e71041e35e26e126aa4508ed7384e8aa031c/pyiceberg/catalog/__init__.py#L113-L119 We want `in-memory` and not `in_memory` to match spark https://github.com/apache/iceberg-python/blob/1d24e71041e35e26e126aa4508ed7384e8aa031c/dev/spark-defaults.conf#L35
1 parent acb3c47 commit 8bfb16c

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

pyiceberg/catalog/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def load_catalog(name: Optional[str] = None, **properties: Optional[str]) -> Cat
252252

253253
catalog_type = None
254254
if provided_catalog_type and isinstance(provided_catalog_type, str):
255-
catalog_type = CatalogType[provided_catalog_type.upper()]
255+
catalog_type = CatalogType(provided_catalog_type.lower())
256256
elif not provided_catalog_type:
257257
catalog_type = infer_catalog_type(name, conf)
258258

tests/catalog/test_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ def given_catalog_has_a_table(
8888
)
8989

9090

91+
def test_load_catalog_in_memory() -> None:
92+
assert load_catalog("catalog", type="in-memory")
93+
94+
9195
def test_load_catalog_impl_not_full_path() -> None:
9296
with pytest.raises(ValueError) as exc_info:
9397
load_catalog("catalog", **{"py-catalog-impl": "CustomCatalog"})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy