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 (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 Union[str, int]

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.

append(self, item) inherited

S.append(value) -- append value to the end of the sequence

insert(self, i, item) inherited

S.insert(index, value) -- insert value before index

pop(self, i=-1) inherited

S.pop([index]) -> item -- remove and return item at index (default last). Raise IndexError if list is empty or index is out of range.

remove(self, item) inherited

S.remove(value) -- remove first occurrence of value. Raise ValueError if the value is not present.

clear(self) inherited

S.clear() -> None -- remove all items from S

count(self, item) inherited

S.count(value) -> integer -- return number of occurrences of value

index(self, item, *args) inherited

S.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

reverse(self) inherited

S.reverse() -- reverse IN PLACE

extend(self, other) inherited

S.extend(iterable) -- extend sequence by appending elements from the iterable

Back to top