tm1py
tm1py copied to clipboard
`tm1.bedrock` module to expose bedrock processes conveniently
We could introduce a module to TM1py that offers bedrock process execution most conveniently.
Based on the existing bedrock processes, we could introduce functions to TM1py that map 1 to 1 to the bedrock processes. Example:
with TM1Service(**tm1_params) as tm1:
success, status, error_log_file = tm1.bedrock.bedrock_cube_data_clear(
pStrictErrorHandling=1,
pCube='Sales',
pFilter='Year¦ 2022 + 2023 & Scenario¦ Actual + Budget & Organization¦ North America Operations')
This provides two advantages over calling bedrock processes the "normal way":
- The TI process parameters (e.g., pCube) are 1 to 1 mapped as arguments to the Python function. This helps to code and reduces lookups and errors.
- TM1py could maintain a collection of JSON files (as part of the repo or in a separate repo) that describe the bedrock process collection and inject bedrock processes that don't already exist in a TM1 model.
I imagine that Bedrock process injection is switched off by default.
It could be passed to the bedrock_cube_data_clear
function through an argument like create_if_necessary.
The actual code for the TM1py module could be generated by script based on the bedrock process JSON definitions.
Hello Marius, do you already have an idea how to check if the existing Bedrock processes have a minimum version?
Is there already a solution? I thought about this and maybe a solution is to introduce a Front Matter (inspired by Jekyll Link) in the TI, where the version of the ti is exposed.
Example:
#Section Prolog
#****Begin: Generated Statements***
#****End: Generated Statements****
#---
# version = 1.1.3
#---
sText = 'IBM Cognos TM1';
Happy to hear if anyone have a other/better solution.
TBH my first thought was that TM1py uses whatever bedrock version is available in the instance. Only if bedrock isn't installed at all would TM1py "inject" it. This is would be the least invasive approach I think.
But I do agree that it would be right for bedrock processes to have a kind of "Front Matter" in the prolog. If this existed, the TM1py bedrock functions could be more intelligent and raise version errors.
@lotsaram What are your thoughts on the version comments?
Is this already covered by the existing comment header present in the prolog of all bedrock processes?
#################################################################################################
##~~Join the bedrock TM1 community on GitHub https://github.com/cubewise-code/bedrock Ver 4.0~~##
#################################################################################################
Currently however AFAIK the version portion of the header isn't updated with each release. It's frozen at 4.0. But this would be the minimum version.