Skip to content

celonis_data_objects.py

CelonisDataObject (ABC)

Base Celonis data object.

Each Celonis resource object can be uniquely identified by a key and an ID. In order to map the relation in the hierarchical structure, each data object references its parent object, e.g. a Studio Package's parent is the respective Studio Space. This object class is only intended to model the Celonis data object structure as an Abstract Base Class.

Parameters:

Name Type Description Default
parent CelonisApiObject

The parent object.

required
data Dict

The data of this object provided by the Celonis API.

required

data property readonly

A reference to the data of this object.

name: str property writable

Name of the object via data['name'] if available.

key: str property writable

Key of the object via data['key'] if available.

CelonisCollection (Generic, UserList)

A UserList implementation to work with Celonis data objects.

Parameters:

Name Type Description Default
init_list Iterable[~T]

An iterable of type T used to store the contents of the CelonisCollection.

required

ids: Dict[str, ~T] property readonly

Dictionary of Celonis data objects with their respective ID as key.

names: Dict[str, ~T] property readonly

Dictionary of Celonis data objects with their respective Name as key. If multiple Celonis data objects have the same Name, only the first one is mapped.

keys: Dict[str, ~T] property readonly

Dictionary of Celonis data objects with their respective Key as key. If multiple Celonis data objects have the same Key, only the first one is mapped.

find(self, id_or_name, default='error', ignore_name_mapping=True, **kwargs)

Performs a search in the CelonisCollection to find an object by ID or Name and returns the first matching result.

Parameters:

Name Type Description Default
id_or_name str

The ID or Name of the object to look for.

required
default Any

Whatever is set to default is returned if no matching object is found, if "error" will raise celonis_api.errors.PyCelonisNotFoundError.

'error'
ignore_name_mapping bool

If True ignores name mappings of #{<actual name>} to only check against <actual name>.

True

Exceptions:

Type Description
PyCelonisNotFoundError

if default is set to "error"

Examples:

Use find to get the object via name:

# iterate over all spaces and get the space by name "Default"
space = celonis.spaces.find("Default")

Returns:

Type Description
~T

The first item that matches id_or_name or the default.

filter(self, condition, field=None)

Reduces the collection given the condition.

Parameters:

Name Type Description Default
condition Union[Callable, str, int]

Passed to builtin filter

required
field str

Define to check against a specific data[field] value with the condition.

None

Examples:

Use filter to reduce the Collection to objects matching the condition:

# reduce list to all datamodels which have "Celonis" in their name
celonis_dms  = c.datamodels.filter(lambda dm: "Celonis" in dm.name)

Returns:

Type Description
CelonisCollection[T]

A new CelonisCollection which items match the condition.