Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pyiceberg/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class CatalogType(Enum):
SQL = "sql"
IN_MEMORY = "in-memory"
BIGQUERY = "bigquery"
HADOOP = "hadoop"


def load_rest(name: str, conf: Properties) -> Catalog:
Expand Down Expand Up @@ -201,6 +202,12 @@ def load_dynamodb(name: str, conf: Properties) -> Catalog:
raise NotInstalledError("AWS DynamoDB support not installed: pip install 'pyiceberg[dynamodb]'") from exc


def load_hadoop(name: str, conf: Properties) -> Catalog:
from pyiceberg.catalog.hadoop import HadoopCatalog

return HadoopCatalog(name, **conf)


def load_sql(name: str, conf: Properties) -> Catalog:
try:
from pyiceberg.catalog.sql import SqlCatalog
Expand Down Expand Up @@ -238,6 +245,7 @@ def load_bigquery(name: str, conf: Properties) -> Catalog:
CatalogType.SQL: load_sql,
CatalogType.IN_MEMORY: load_in_memory,
CatalogType.BIGQUERY: load_bigquery,
CatalogType.HADOOP: load_hadoop,
}


Expand Down Expand Up @@ -277,6 +285,11 @@ def _check_required_catalog_properties(name: str, catalog_type: CatalogType, con
raise ValueError(
f"URI missing, please provide using --uri, the config or environment variable PYICEBERG_CATALOG__{name.upper()}__URI"
)
if catalog_type is CatalogType.HADOOP and WAREHOUSE_LOCATION not in conf:
raise ValueError(
"Warehouse missing, please provide using the warehouse property or environment variable "
f"PYICEBERG_CATALOG__{name.upper()}__WAREHOUSE"
)


def load_catalog(name: str | None = None, **properties: str | None) -> Catalog:
Expand Down
Loading
Loading