ElementService
from skipcheck_tm1.services import ElementService Elements: /Dimensions('d')/Hierarchies('h')/Elements, an element's parents,
components and edges, and the operations bound to an element.
TM1 (11.8) ignores Name in an element PATCH, so elements can't be renamed, and
rejects Attributes, whose values are cells of the
}ElementAttributes_<dimension> cube. update refuses
both, saying why.
List elements with a query: here, the consolidations.
# The names of the consolidated elements, in name order
consolidated = ODataQuery.none().select(Element.NAME).filter(Element.TYPE.eq(ElementType.CONSOLIDATED)).order_by(Element.NAME)
return [element.name for element in tm1.elements.list("Region", "Region", consolidated)]
Add an element under a consolidation. A new element is a root until it has a parent:
# A new element is a root; SetComponent then puts it last under Total
tm1.elements.create("Region", "Region", ElementPatch.builder().name("West").type(ElementType.NUMERIC).build())
tm1.elements.set_component("Region", "Region", "Total", "West")
Read a consolidation's children:
# The children of Total, in order
return [element.name for element in tm1.elements.components("Region", "Region", "Total", ODataQuery.none().select(Element.NAME))]
The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncElementService.
Members
list | GET …/Hierarchies('h')/Elements. |
get | The element, or a Tm1NotFoundError. |
create | Adds an element, as a root of the hierarchy. |
update | Changes the properties the patch sets, such as its type; with etag, only if the element hasn't changed since it was read (If-Match).Raises ValueError if the patch sets Name, which TM1 ignores, or Attributes, which it rejects. |
delete | DELETE …/Elements('e'), with the element's edges and data. |
parents | GET …/Elements('e')/Parents. |
components | A consolidation's children, in order. |
edges | GET …/Elements('e')/Edges. |
hierarchy | GET …/Elements('e')/Hierarchy. |
set_component | Makes child a child of parent, with weight (TM1's default is 1), placed just before the child before, or without it *last* among its children. |
lock | Stops everyone else changing the element until it's unlocked. |
unlock | tm1.Unlock. |
reserve | Stops everyone else changing the element's data until it's released. |
release | tm1.Release. |
list
list(dimension: str, hierarchy: str, query: ODataQuery | None = None, **options: Any) -> list[Element]GET …/Hierarchies('h')/Elements.
TM1 REST Navigation Hierarchy/Elements
get
get(dimension: str, hierarchy: str, element: str, query: ODataQuery | None = None, **options: Any) -> ElementGET …/Elements('e'): the element, or a Tm1NotFoundError.
TM1 REST Navigation Hierarchy/Elements
create
create(dimension: str, hierarchy: str, element: Any) -> ElementPOST …/Elements: adds an element, as a root of the hierarchy.
TM1 REST Navigation Hierarchy/Elements
update
update(dimension: str, hierarchy: str, element: str, patch: Any, etag: str | None = None) -> NonePATCH …/Elements('e'): changes the properties the patch sets, such as its type; with etag, only if the element hasn't changed since it was read (If-Match).
Raises ValueError if the patch sets Name, which TM1 ignores, or Attributes, which it rejects.
TM1 REST Navigation Hierarchy/Elements
delete
delete(dimension: str, hierarchy: str, element: str) -> NoneDELETE …/Elements('e'), with the element's edges and data.
TM1 REST Navigation Hierarchy/Elements
parents
parents(dimension: str, hierarchy: str, element: str, query: ODataQuery | None = None, **options: Any) -> list[Element]GET …/Elements('e')/Parents.
TM1 REST Navigation Element/Parents
components
components(dimension: str, hierarchy: str, element: str, query: ODataQuery | None = None, **options: Any) -> list[Element]GET …/Elements('e')/Components: a consolidation's children, in order.
TM1 REST Navigation Element/Components
edges
edges(dimension: str, hierarchy: str, element: str, query: ODataQuery | None = None, **options: Any) -> list[Edge]GET …/Elements('e')/Edges.
TM1 REST Navigation Element/Edges
hierarchy
hierarchy(dimension: str, hierarchy: str, element: str, query: ODataQuery | None = None, **options: Any) -> HierarchyGET …/Elements('e')/Hierarchy.
TM1 REST Navigation Element/Hierarchy
set_component
set_component(dimension: str, hierarchy: str, parent: str, child: str, *, before: str | None = None, weight: float | None = None) -> Nonetm1.SetComponent: makes child a child of parent, with weight (TM1's default is 1), placed just before the child before, or without it *last* among its children. ($metadata doesn't say; TM1 11.8 puts it last.)
TM1 REST Action Element/SetComponent
lock
lock(dimension: str, hierarchy: str, element: str) -> Nonetm1.Lock: stops everyone else changing the element until it's unlocked. Needs schema 11.8.23.
TM1 REST Action Element/Lock
unlock
unlock(dimension: str, hierarchy: str, element: str) -> Nonetm1.Unlock. Needs schema 11.8.23.
TM1 REST Action Element/Unlock
reserve
reserve(dimension: str, hierarchy: str, element: str) -> Nonetm1.Reserve: stops everyone else changing the element's data until it's released. Needs schema 11.8.34.
TM1 REST Action Element/Reserve
release
release(dimension: str, hierarchy: str, element: str) -> Nonetm1.Release. Needs schema 11.8.34.
TM1 REST Action Element/Release