CubeService
from skipcheck_tm1.services import CubeServiceUsed 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
list | Every cube, control cubes included. |
model_cubes | The cubes that aren't control cubes (whose names start with }). |
control_cubes | The control cubes, such as }ClientGroups. |
get | The cube, or a Tm1NotFoundError if there's none. |
create | Creates a cube over existing dimensions, bound in order with CubePatch.Builder.bind_dimensions, and optionally its rules. |
update | Changes the properties the patch sets, typically Rules or DrillthroughRules; None clears them. |
delete | DELETE Cubes('name'). |
dimensions | The cube's dimensions, in the cube's order. |
dimensions_storage_order | The dimensions in the order TM1 stores the cube's cells. |
reorder_dimensions | Changes the order TM1 stores the cube's cells in, and returns the change in memory use, as a percentage. |
load | Loads the cube into memory. |
unload | Unloads the cube from memory. |
lock | tm1.Lock. |
unlock | tm1.Unlock. |
reserve | No one else can change the cube until it's released. |
release | tm1.Release. |
check_rules | 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. |
trace_cell_calculation | How a cell's value is calculated, component by component; tuple maps each dimension to an element. |
trace_feeders | What a cell feeds. |
check_feeders | The 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) -> CubeGET Cubes('name'): the cube, or a Tm1NotFoundError if there's none.
TM1 REST EntitySet Cubes
create
create(cube: Any) -> CubePOST 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) -> NonePATCH 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) -> NoneDELETE 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]) -> floattm1.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) -> Nonetm1.Load: loads the cube into memory.
TM1 REST Action Cube/Load
unload
unload(name: str) -> Nonetm1.Unload: unloads the cube from memory.
TM1 REST Action Cube/Unload
lock
lock(name: str) -> Nonetm1.Lock.
TM1 REST Action Cube/Lock
unlock
unlock(name: str) -> Nonetm1.Unlock.
TM1 REST Action Cube/Unlock
reserve
reserve(name: str) -> Nonetm1.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) -> Nonetm1.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) -> CalculationComponenttm1.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) -> FeederTracetm1.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