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
2 files changed
tree: 1233127271adf3215f16e967a640d877c5ae048f
  1. .github/
  2. dev/
  3. mkdocs/
  4. pyiceberg/
  5. tests/
  6. vendor/
  7. .asf.yaml
  8. .codespellrc
  9. .gitignore
  10. .markdownlint.yaml
  11. .pre-commit-config.yaml
  12. build-module.py
  13. LICENSE
  14. Makefile
  15. MANIFEST.in
  16. NOTICE
  17. poetry.lock
  18. pyproject.toml
  19. README.md
  20. ruff.toml
README.md

Iceberg Python

PyIceberg is a Python library for programmatic access to Iceberg table metadata as well as to table data in Iceberg format. It is a Python implementation of the Iceberg table spec.

The documentation is available at https://py.iceberg.apache.org/.

Get in Touch