What is TM1py?
Python is a widely-used general-purpose programming language that lets you work quickly and integrate systems more effectively.
Why you should use it?
- Do stuff across different TM1 instances (e.g. reschedule all chores on all instances by -1 hour, synchronize cubes throughout TM1 instances)
- Get insights from your TM1 model. (e.g. Which views use this subset?, which process has an ODBC Datasource?)
- Export TM1 data to XML, JSON, YAML, XLSX, …
- Bring Regular Expressions, Lists, Dictionaries, Classes, Functions and all kind of programming concepts to the TM1 world, that make your life easier as a developer.
- Run TM1 processes and write to TM1 in parallel.
- Generate MDX Queries from cube views.
All samples can be downloaded from the github.com/cubewise-code/TM1py-samples.
Reschedule all chores on once instance by - 1 hour:
with TM1Service(address='localhost', port=8001, user='admin', password='apple', ssl=True) as tm1: for chore in tm1.chores.get_all(): chore.reschedule(hours=-1) tm1.chores.update(chore)
Find unused dimensions
from TM1py.Services import TM1Service # Connect to TM1 with TM1Service(address='localhost', port=8001, user='admin', password='apple', ssl=True) as tm1: # get all dimensions all_dimensions = tm1.dimensions.get_all_names() # get all cubes all_cubes = tm1.cubes.get_all() # find used dimensions used_dimensions = set() for cube in all_cubes: used_dimensions.update(cube.dimensions) # determine unused dimensions unused_dimensions = set(all_dimensions) - used_dimensions print(unused_dimensions)
Generate a TM1 MDX Query from cube view
from TM1py.Services import TM1Service # Establish connection to TM1 Server with TM1Service(address='localhost', port=8001, user='admin', password='apple', ssl=True) as tm1: # Instantiate TM1py.NativeView object nv = tm1.views.get_native_view('Plan_BudgetPlan', 'High Level Profit And Loss', private=False) # Retrieve MDX from native view. Print it print(nv.MDX)
All of the code, documents and information in TM1py are to be deemed without warranty.