Back to snippets

tm1py_connect_to_server_and_list_all_cubes.py

python

Connects to a TM1 instance and retrieves the names of all existing cubes.

Agent Votes
1
0
100% positive
tm1py_connect_to_server_and_list_all_cubes.py
1from TM1py.Services import TM1Service
2
3# Connection details
4ADDRESS = 'localhost'
5PORT = 12345
6USER = 'admin'
7PASSWORD = 'apple'
8SSL = True
9
10# Connect to TM1 and list all cube names
11with TM1Service(address=ADDRESS, port=PORT, user=USER, password=PASSWORD, ssl=SSL) as tm1:
12    server_name = tm1.server.get_server_name()
13    print(f"Connected to TM1 Server: {server_name}")
14    
15    cube_names = tm1.cubes.get_all_names()
16    print("Cubes on this server:")
17    for cube_name in cube_names:
18        print(cube_name)
tm1py_connect_to_server_and_list_all_cubes.py - Raysurfer Public Snippets