DrillthroughService
from skipcheck_tm1.services import DrillthroughService Drillthrough: from a cell to the detail behind it, through a drillthrough process
(}Drill_…). A cube drillthrough returns a cellset, of a view the
process returns; a relational one returns rows from an ODBC source, directly or kept as
a Rowset.
A cell's drillthroughs come from the cube's DrillthroughRules, which name the
process; scripts lists them for a cell of a cellset. TM1 (11.8) passes such a
process the cube's name and the cell's element on each of its dimensions, so the
process must declare that many parameters (the cube's name, then one per dimension, in
order); otherwise running the cell's drillthrough fails with "process parameter count
error" (code 248). Run directly (execute_process), it takes the parameters
given. The returned cellsets and rowsets stay on the server until deleted, like any
cellset.
$metadata declares a relational row (DrillthroughRow) with no
properties and not open, so its columns would all be lost in a typed row: relational
rows come as plain JSON. A rowset's rows (RowsetRow) are open, and keep theirs
in dynamicProperties.
Drill from a cell of a query to the detail behind it:
# The detail behind one cell: query it, run its first cube drillthrough, and read
# the cellset that returns. Both cellsets are deleted at the end.
mdx = (
"SELECT {[Month].[Month].[Jan]} ON 0, {[Region].[Region].[North]} ON 1 FROM [Sales] WHERE ([Version].[Version].[Actual], [Measure].[Measure].[Revenue])"
)
cells = ODataQuery.none().expand(Cellset.CELLS, lambda c: c.select(CellsetCell.ORDINAL, CellsetCell.VALUE))
source = tm1.cellsets.execute(mdx)
try:
script = next(s for s in tm1.drillthrough.scripts(source.id, 0) if isinstance(s, CubeDrillthrough))
detail = tm1.drillthrough.execute(source.id, 0, script.name, cells)
try:
return list(detail.cells)
finally:
tm1.cellsets.delete(detail.id)
finally:
tm1.cellsets.delete(source.id)
Run a drillthrough process directly, with its parameters:
# A drillthrough process run directly, with the parameters it declares
parameters = [
ProcessParameterPatch.builder().name("pRegion").value("North").build(),
ProcessParameterPatch.builder().name("pMonth").value("Jan").build(),
]
values = ODataQuery.none().expand(Cellset.CELLS, lambda c: c.select(CellsetCell.VALUE))
detail = tm1.drillthrough.execute_process("}Drill_Sales Detail", parameters, values)
try:
return list(detail.cells)
finally:
tm1.cellsets.delete(detail.id)
Read the rows of a relational drillthrough as a rowset:
# Rows from a relational drillthrough, kept as a rowset and read from it.
# Each row's columns are in its model_extra.
orders = tm1.drillthrough.execute_relational_process_with_rowset("}Drill_Sales Orders", [])
try:
return [(row.model_extra or {}).get("OrderNumber") for row in tm1.drillthrough.rows(orders.id)]
finally:
tm1.drillthrough.delete_rowset(orders.id)
The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncDrillthroughService.
Members
scripts | The drillthroughs a cell has, by name, each a CubeDrillthrough or RelationalDrillthrough. |
execute | tm1.Execute on a cell's cube drillthrough (named as by scripts). |
execute_relational | tm1.Execute on a cell's relational drillthrough. |
execute_relational_with_rowset | tm1.ExecuteWithRowset on a cell's relational drillthrough. |
execute_process | Runs a cube drillthrough process (such as }Drill_Sales) directly, with its parameters (ProcessParameterPatch, by name and value), and returns the cellset of the view it returns, left on the server until deleted. |
execute_relational_process | Runs a relational drillthrough process directly; its rows, as JSON. |
execute_relational_process_with_rowset | Runs a relational drillthrough process directly, keeping its rows as a rowset, with its ID. |
rowset | GET Rowsets('id'). |
rows | Each row's columns are in its model_extra; select, filter, and page ($top, $skip) with the query. |
delete_rowset | Frees the rowset on the server. |
scripts
scripts(cellset: str, ordinal: int, query: ODataQuery | None = None, **options: Any) -> list[Drillthrough]GET Cellsets('id')/Cells(n)/DrillthroughScripts: the drillthroughs a cell has, by name, each a CubeDrillthrough or RelationalDrillthrough.
TM1 REST Navigation CellsetCell/DrillthroughScripts
execute
execute(cellset: str, ordinal: int, drillthrough: str, query: ODataQuery | None = None, **options: Any) -> Cellsettm1.Execute on a cell's cube drillthrough (named as by scripts): the cellset of the view its process returns, left on the server until deleted. Needs schema 10.2.2.6. The process must take the cube's name and one parameter per dimension (see the class description).
TM1 REST Action CubeDrillthrough/Execute
execute_relational
execute_relational(cellset: str, ordinal: int, drillthrough: str) -> list[Any]tm1.Execute on a cell's relational drillthrough: its rows, as JSON. Needs schema 10.2.2.6.
TM1 REST Action RelationalDrillthrough/Execute
execute_relational_with_rowset
execute_relational_with_rowset(cellset: str, ordinal: int, drillthrough: str) -> Rowsettm1.ExecuteWithRowset on a cell's relational drillthrough: its rows, kept as a rowset (with its ID) to read with rows. Needs schema 11.6.0.
TM1 REST Action RelationalDrillthrough/ExecuteWithRowset
execute_process
execute_process(process: str, parameters: Sequence[Any], query: ODataQuery | None = None, **options: Any) -> CellsetExecuteCubeDrillthrough: runs a cube drillthrough process (such as }Drill_Sales) directly, with its parameters (ProcessParameterPatch, by name and value), and returns the cellset of the view it returns, left on the server until deleted. Needs schema 11.2.0.
TM1 REST ActionImport ExecuteCubeDrillthrough
execute_relational_process
execute_relational_process(process: str, parameters: Sequence[Any]) -> list[Any]ExecuteRelationalDrillthrough: runs a relational drillthrough process directly; its rows, as JSON. Needs schema 11.2.0.
TM1 REST ActionImport ExecuteRelationalDrillthrough
execute_relational_process_with_rowset
execute_relational_process_with_rowset(process: str, parameters: Sequence[Any]) -> RowsetExecuteRelationalDrillthroughWithRowset: runs a relational drillthrough process directly, keeping its rows as a rowset, with its ID. Needs schema 11.6.0.
TM1 REST ActionImport ExecuteRelationalDrillthroughWithRowset
rowset
rowset(id: str, query: ODataQuery | None = None, **options: Any) -> RowsetGET Rowsets('id').
TM1 REST EntitySet Rowsets
rows
rows(id: str, query: ODataQuery | None = None, **options: Any) -> list[RowsetRow]GET Rowsets('id')/Rows: each row's columns are in its model_extra; select, filter, and page ($top, $skip) with the query.
TM1 REST Navigation Rowset/Rows
delete_rowset
delete_rowset(id: str) -> NoneDELETE Rowsets('id'): frees the rowset on the server.
TM1 REST EntitySet Rowsets