Implementation:Apache Paimon CatalogFactory Create
| Knowledge Sources | |
|---|---|
| Domains | Data_Lake, Table_Format |
| Last Updated | 2026-02-07 00:00 GMT |
Overview
Concrete tool for creating Paimon catalog instances provided by the Apache Paimon Python SDK.
Description
The CatalogFactory.create() static method takes a dictionary of catalog options and returns the appropriate Catalog implementation. It supports filesystem and rest catalog types via an internal registry (CATALOG_REGISTRY). The method inspects the 'metastore' key in the provided options dictionary to determine which catalog class to instantiate. If no metastore key is provided, it defaults to the filesystem catalog. This factory-based approach ensures that catalog creation is centralized and consistent across all Paimon workflows.
Usage
Use this implementation as the first step in any Paimon workflow. Construct a dictionary of catalog options specifying the metastore type, warehouse path, and any required authentication parameters, then pass it to CatalogFactory.create() to obtain a ready-to-use catalog instance.
Code Reference
Source Location
- Repository: Apache Paimon
- File: paimon-python/pypaimon/catalog/catalog_factory.py
- Lines: L28-44
Signature
class CatalogFactory:
CATALOG_REGISTRY = {
"filesystem": FileSystemCatalog,
"rest": RESTCatalog,
}
@staticmethod
def create(catalog_options: Dict) -> Catalog:
Import
from pypaimon.catalog.catalog_factory import CatalogFactory
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| catalog_options | Dict | Yes | Dictionary with keys like 'metastore' ('filesystem' or 'rest'), 'uri', 'warehouse', 'token.provider', 'token'
|
Outputs
| Name | Type | Description |
|---|---|---|
| return | Catalog | A Catalog instance (either FileSystemCatalog or RESTCatalog) based on the metastore option
|
Usage Examples
Basic Usage
from pypaimon.catalog.catalog_factory import CatalogFactory
catalog_options = {
'metastore': 'filesystem',
'warehouse': '/tmp/paimon_warehouse',
}
catalog = CatalogFactory.create(catalog_options)