openclean.engine.store.default module
Default implementation for the object store. In this implementations all objects are maintained as separate entries in a data store. this way the default implementation is flexible towards the storage backend.
- class openclean.engine.store.default.DefaultObjectStore(identifier: str, factory: openclean.engine.object.base.ObjectFactory, store: openclean.data.store.base.DataStore, defaults: Optional[List[openclean.engine.object.base.ObjectHandle]] = None)
Bases:
openclean.engine.store.base.ObjectStore
Implementation of the object store interface. Maintains object descriptors and data objects as separate entries in a data store. Keeps descriptors in memory cache for fast access. Information about stored objects is also maintained as a separate object in the data store.
Provides the option to initialize the store with a set of default objects. THese oblects can be overwritten by the user but they are not stored in the associated data store.
- delete_object(name: str, namespace: Optional[str] = None)
Remove the object that is identified by the given name and namespace from the repository. Raises a KeyError if the referenced object does not exist.
- Parameters
name (string) – Unique object name.
namespace (string, default=None) – Optional identifier for the object namespace.
- Raises
KeyError –
- get_object(name: str, namespace: Optional[str] = None) openclean.engine.object.base.ObjectHandle
Get the deseralized object handle that is identified by the given name and namespace from the repository. Raises a KeyError if the referenced object does not exist.
- Parameters
name (string) – Unique object name.
namespace (string, default=None) – Optional identifier for the object namespace.
- Return type
any
- Raises
KeyError –
- insert_object(object: openclean.engine.object.base.ObjectHandle)
Store an object in the repository. If an object with the same identifier (i.e., name and namespace) exists it will be replaced by the given object.
- Parameters
object (openclean.engine.object.base.ObjectHandle) – Object that is being inserted into the repository.
- to_listing() List[Dict]
Get a list of descriptor serializations for the registered objects.
- Return type
list of dict
- class openclean.engine.store.default.StoredObject(name: str, descriptor: Dict, object_id: Optional[str] = None, data_id: Optional[str] = None)
Bases:
object
Metadata about objects in the store. Maintains the identifier for the descriptor and the data object together with the serialized object descriptor.
- data_id: Optional[str] = None
- descriptor: Dict
- property is_default: bool
Flag indicating whether the object is maintained by the data store or was provided as part of a set of default objects. Only objects in the data store will have an object and data identifier.
- Return type
bool
- name: str
- object_id: Optional[str] = None
- to_dict() Dict
Default serialization of the object for the index store.
- Return type
dict