Is there a way to update rules?
I would like to deploy the rules from one instance/server to another. I know how to get the rules, but can I also update them?
Hi hermie64,
I did it once in same instance. (Probably will work different instances)
This coding will help you;
##Rule Update
#Get SourceCube rule
SourceRule = SourceCube.rules
TargetCube = tm1_target.cubes.get("_Sales")
#Write Source to Target Rule
TargetCube.rules = SourceRule
#Update the Target Rule
tm1_target.cubes.update(TargetCube)
Cube by using the get method on the source TM1 connectionCube instance to the update method using the target TM1 connection.from TM1py.Services import TM1Service
# Establish source TM1 connection
tm1_source = TM1Service()
# Establish Target TM1 connection
tm1_target = TM1Service()
# Get Cube metadata (this includes rules) from the source instance
SourceCubeWithRules = tm1_source.cubes.get('cube_name')
# Update the cube in target instance
tm1_target.cubes.update(SourceCubeWithRules)
That worked, thanks @AliUgurGures and @rkvinoth
Most helpful comment
Cubeby using thegetmethod on the source TM1 connectionCubeinstance to theupdatemethod using the target TM1 connection.