Register own HWM Store class#

@etl_entities.hwm_store.hwm_store_class_registry.register_hwm_store_class#

Decorator for registering some Store class with a name.

Thin wrapper for HWMStoreClassRegistry.add.

Examples

from etl_entities.hwm_store import (
    HWMStoreClassRegistry,
    register_hwm_store_class,
    BaseHWMStore,
)

@register_hwm_store_class("my_store")
class MyHWMStore(BaseHWMStore): ...

HWMStoreClassRegistry.get("my_store") == MyHWMStore
class etl_entities.hwm_store.hwm_store_class_registry.HWMStoreClassRegistry#

Registry class of different HWM stores.

classmethod add(alias: str, klass: type[BaseHWMStore]) None#

Add alias for HWM Store class.

This alias then can be used by detect_hwm_store.

Examples

from etl_entities.hwm_store import HWMStoreClassRegistry, BaseHWMStore

HWMStoreClassRegistry.get("my_store")  # raise KeyError

class MyHWMStore(BaseHWMStore): ...

HWMStoreClassRegistry.add("my_store", MyHWMStore)
HWMStoreClassRegistry.get("my_store") == MyHWMStore
classmethod aliases() Collection[str]#

Returl all known HWM store aliases, like memory or yaml

classmethod get(alias: str | None = None) type#

Return HWM Store class by its alias, or return default HWM Store class.

Examples

from etl_entities.hwm_store import HWMStoreClassRegistry, MemoryHWMStore

HWMStoreClassRegistry.get("memory") == MemoryHWMStore

HWMStoreClassRegistry.get("unknown")  # raise KeyError

HWMStoreClassRegistry.get()  # some default HWM Store, see `set_default`
classmethod set_default(klass: type[BaseHWMStore]) None#

Set specific HWM store class as default HWM Store implementation.

Examples

from etl_entities.hwm_store import HWMStoreClassRegistry, BaseHWMStore

class MyHWMStore(BaseHWMStore): ...

HWMStoreClassRegistry.set_default(MyHWMStore)

assert HWMStoreClassRegistry.get() == MyHWMStore