Tm1py: Really Basic Question

Created on 18 Jun 2020  路  4Comments  路  Source: cubewise-code/tm1py

would you have a code snippet that explains how to do a basic connect and read one cell from an instance name?
if it also does an ibmcloud server instance - would be even better, thanks!

question

Most helpful comment

Hi,

Anything/Everything is possible. Its just that users won't be programatically strong.
It is up to us to provide them a User Interface (could be desktop GUI or a webpage).

For example, you can create a web page where users can select the required cubeview from a dropdown and once selected you can make the data visible using a Dataframe.
Millions of use cases are available.. Please go through the examples provided in the below link to get a good understanding of how to leverage TM1py.

https://code.cubewise.com/blog/getting-started-with-tm1py

Incase of IBM Cloud, they don't allow users (interactive accounts) to directly communicate with TM1 application over REST API.
Alternatively, you will have to setup a non-interactive account (get in touch IBM team for this). You can basically direct all their requests via this non-interactive account. You can also have 'n' number non-interactive accounts setup.
Note: With non-interactive accounts in place, users will be using that account's security level and not their own security level.

All 4 comments

I recommend you start reading up on the Cubewise blog. The guys provide a really good 'getting started' guide.
https://code.cubewise.com/blog/getting-started-with-tm1py

Hi @VY109 ,

here is a sample how to connect to TM1 in the IBM cloud.

tm1 = TM1Service(base_url='https://[Customer_Name].planning-analytics.ibmcloud.com/tm1/api/[Server Name]/', user='non-interactive username', password='non-interactive user password', namespace='LDAP', ssl=True)

You must have a non-interactive user set up though.
You can read more about it here:
https://www.tm1forum.com/viewtopic.php?t=14993

To retrieve data from a cubeview you can use the execute_view method from the CellService.

from TM1py import TM1Service

ADDRESS = "localhost"
PORT = 12354
SSL = True
USER = "admin"
PASSWORD = "apple"

with TM1Service(address=ADDRESS, port=PORT, ssl=SSL, user=USER, password=PASSWORD) as tm1:
    data = tm1.cubes.cells.execute_view("Sales", "Default", private=False)
    print(data)

Thanks guys!
so @MariusWirtz is there ability/potential for a real user to read from a cube also?

Hi,

Anything/Everything is possible. Its just that users won't be programatically strong.
It is up to us to provide them a User Interface (could be desktop GUI or a webpage).

For example, you can create a web page where users can select the required cubeview from a dropdown and once selected you can make the data visible using a Dataframe.
Millions of use cases are available.. Please go through the examples provided in the below link to get a good understanding of how to leverage TM1py.

https://code.cubewise.com/blog/getting-started-with-tm1py

Incase of IBM Cloud, they don't allow users (interactive accounts) to directly communicate with TM1 application over REST API.
Alternatively, you will have to setup a non-interactive account (get in touch IBM team for this). You can basically direct all their requests via this non-interactive account. You can also have 'n' number non-interactive accounts setup.
Note: With non-interactive accounts in place, users will be using that account's security level and not their own security level.

Was this page helpful?
0 / 5 - 0 ratings