skipcheck

TM1 client · Docs · Cubes and views

CubeService

from skipcheck_tm1.services import CubeService

Used in the walkthroughs Connect and list your cubes, Test your code against a real TM1, Add TM1 to a Spring Boot application.

Cubes: /Cubes, a cube's dimensions, and the operations bound to a cube. Views have a service of their own; cell data is read and written through cellsets.

List cubes with a query: here, the model cubes whose names start with "Sales".

# The names of the model cubes starting with "Sales", in name order
sales = ODataQuery.none().select(Cube.NAME).filter(Filter.starts_with(Cube.NAME, "Sales")).order_by(Cube.NAME)
return [cube.name for cube in tm1.cubes.model_cubes(sales)]

Create a cube over existing dimensions, bound in order:

# A cube over two existing dimensions, in this order
dimensions = ODataPath.of("Dimensions")
return tm1.cubes.create(CubePatch.builder().name("Sales").bind_dimensions(dimensions.key("Region"), dimensions.key("Month")).build())

Change a cube's rules, checking them first:

# TM1 saves rules even when they don't compile, so check them first
rules = "SKIPCHECK;\n['Margin'] = N: ['Revenue'] - ['Cost'];"
errors = tm1.cubes.check_rules("Sales", rules)
if errors:
    raise ValueError(f"The rules don't compile: {errors}")
tm1.cubes.update("Sales", CubePatch.builder().rules(rules).build())

The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncCubeService.

Members

listEvery cube, control cubes included.
model_cubesThe cubes that aren't control cubes (whose names start with }).
control_cubesThe control cubes, such as }ClientGroups.
getThe cube, or a Tm1NotFoundError if there's none.
createCreates a cube over existing dimensions, bound in order with CubePatch.Builder.bind_dimensions, and optionally its rules.
updateChanges the properties the patch sets, typically Rules or DrillthroughRules; None clears them.
deleteDELETE Cubes('name').
dimensionsThe cube's dimensions, in the cube's order.
dimensions_storage_orderThe dimensions in the order TM1 stores the cube's cells.
reorder_dimensionsChanges the order TM1 stores the cube's cells in, and returns the change in memory use, as a percentage.
loadLoads the cube into memory.
unloadUnloads the cube from memory.
locktm1.Lock.
unlocktm1.Unlock.
reserveNo one else can change the cube until it's released.
releasetm1.Release.
check_rulesThe syntax errors in the cube's rules, or in rules if given (checked as if they were the cube's, without saving them); empty if they compile.
trace_cell_calculationHow a cell's value is calculated, component by component; tuple maps each dimension to an element.
trace_feedersWhat a cell feeds.
check_feedersThe cells under a consolidated cell that aren't fed, though they have values, chosen by selection.

list

list(query: ODataQuery | None = None, **options: Any) -> list[Cube]

GET Cubes: every cube, control cubes included.

TM1 REST EntitySet Cubes

model_cubes

model_cubes(query: ODataQuery | None = None, **options: Any) -> list[Cube]

ModelCubes(): the cubes that aren't control cubes (whose names start with }).

TM1 REST FunctionImport ModelCubes

control_cubes

control_cubes(query: ODataQuery | None = None, **options: Any) -> list[Cube]

ControlCubes(): the control cubes, such as }ClientGroups.

TM1 REST FunctionImport ControlCubes

get

get(name: str, query: ODataQuery | None = None, **options: Any) -> Cube

GET Cubes('name'): the cube, or a Tm1NotFoundError if there's none.

TM1 REST EntitySet Cubes

create

create(cube: Any) -> Cube

POST Cubes: creates a cube over existing dimensions, bound in order with CubePatch.Builder.bind_dimensions, and optionally its rules. It needs a name and at least two dimensions; returns the cube as created.

TM1 REST EntitySet Cubes

update

update(name: str, patch: Any, etag: str | None = None) -> None

PATCH Cubes('name'): changes the properties the patch sets, typically Rules or DrillthroughRules; None clears them. With etag (Cube.etag, from a read), sent as If-Match: only if the cube hasn't changed since, else a Tm1PreconditionFailedError.

TM1 (11.8) saves rules even when they don't compile: check them first with check_rules.

TM1 REST EntitySet Cubes

delete

delete(name: str) -> None

DELETE Cubes('name').

TM1 REST EntitySet Cubes

dimensions

dimensions(name: str, query: ODataQuery | None = None, **options: Any) -> list[Dimension]

GET Cubes('name')/Dimensions: the cube's dimensions, in the cube's order. TM1 (11.8) lists the virtual Sandboxes dimension first.

TM1 REST Navigation Cube/Dimensions

dimensions_storage_order

dimensions_storage_order(name: str, query: ODataQuery | None = None, **options: Any) -> list[Dimension]

tm1.DimensionsStorageOrder(): the dimensions in the order TM1 stores the cube's cells. Needs schema 11.4.0.

TM1 REST Function Cube/DimensionsStorageOrder

reorder_dimensions

reorder_dimensions(name: str, dimensions: Sequence[str]) -> float

tm1.ReorderDimensions: changes the order TM1 stores the cube's cells in, and returns the change in memory use, as a percentage.

TM1 REST Action Cube/ReorderDimensions

load

load(name: str) -> None

tm1.Load: loads the cube into memory.

TM1 REST Action Cube/Load

unload

unload(name: str) -> None

tm1.Unload: unloads the cube from memory.

TM1 REST Action Cube/Unload

lock

lock(name: str) -> None

tm1.Lock.

TM1 REST Action Cube/Lock

unlock

unlock(name: str) -> None

tm1.Unlock.

TM1 REST Action Cube/Unlock

reserve

reserve(name: str) -> None

tm1.Reserve: no one else can change the cube until it's released. Needs schema 11.8.34.

TM1 REST Action Cube/Reserve

release

release(name: str) -> None

tm1.Release. Needs schema 11.8.34.

TM1 REST Action Cube/Release

check_rules

check_rules(name: str, rules: str | None = None) -> list[RuleSyntaxError]

tm1.CheckRules: the syntax errors in the cube's rules, or in rules if given (checked as if they were the cube's, without saving them); empty if they compile.

TM1 REST Action Cube/CheckRules

trace_cell_calculation

trace_cell_calculation(name: str, tuple: Mapping[str, str], query: ODataQuery | None = None, **options: Any) -> CalculationComponent

tm1.TraceCellCalculation: how a cell's value is calculated, component by component; tuple maps each dimension to an element. Expand Components (and Components/Tuple) to see them.

TM1 REST Action Cube/TraceCellCalculation Navigation CalculationComponent/Cube Navigation CalculationComponent/Tuple

trace_feeders

trace_feeders(name: str, tuple: Mapping[str, str], query: ODataQuery | None = None, **options: Any) -> FeederTrace

tm1.TraceFeeders: what a cell feeds. TM1 (11.8) needs a path to expand into a complex property (FedCells/Tuple); nested options (FedCells($expand=Tuple)) get 400.

TM1 REST Action Cube/TraceFeeders Navigation FedCellDescriptor/Cube Navigation FedCellDescriptor/Tuple

check_feeders

check_feeders(name: str, tuple: Mapping[str, str], selection: CheckFeedersSelection, query: ODataQuery | None = None, **options: Any) -> list[FedCellDescriptor]

tm1.CheckFeeders: the cells under a consolidated cell that aren't fed, though they have values, chosen by selection.

TM1 REST Action Cube/CheckFeeders Navigation FedCellDescriptor/Cube Navigation FedCellDescriptor/Tuple