caikit.core.data_model.data_backends.base

The base class for data model object backends

Classes

DataModelBackendBase

A base interface class for accessing data from within a given backend

Module Contents

class caikit.core.data_model.data_backends.base.DataModelBackendBase[source]

Bases: abc.ABC

A base interface class for accessing data from within a given backend data layout

abstract get_attribute(data_model_class: Type[caikit.core.data_model.base.DataBase], name: str) Any | caikit.core.data_model.base.DataBase.OneofFieldVal[source]

A data model backend must implement this in order to provide the frontend view the functionality needed to lazily extract data.

Args:
data_model_class (Type[DataBase]): The frontend data model class

that is accessing this attribute

name (str): The name of the attribute to access

Returns:
value: Union[Any, OneofFieldVal]

The extracted attribute value or a OneofFieldVal that wraps the field val with an indicator about the oneof field that is set.

cache_attribute(name: str, value: Any) bool[source]

Determine whether or not to cache the given attribute’s result on the wrapping data model object.

The base implementation always returns True. Derived classes may opt to always return False to fully disable caching, or cache conditionally based on the name/value of the individual field.

Args:

name (str): The name of the attribute to check value (Any): The extracted value

Returns:
should_cache: bool

True if the value should be cached, False otherwise