Jan 3, 2021

TM1py v1.6 is now available

The TM1py community is growing bigger and bigger. For each release, we can see the number of contributions increasing. For v1.6, we would like to thank @rkvinoth, @scrambldchannel, @andreyea, @adscheevel, @wimgielis, @rclapp for contributing code to this release, and many others for reporting bugs and requesting features.

TM1py v1.6 includes many new features and fixes, here some highlights:

Impersonate a user

It is now possible to log in with an admin account and get the data with a specific user’s access. Just need to add the new parameter impersonate=”Marius” when creating a new connection and instead of seeing the data as your user (user=”admin”), you will see it with Marius’ access. It will give you also access to all private objects.

with TM1Service(address="", port=12354, ssl=True, user="admin", password="apple", impersonate="Marius") as tm1:    print(tm1.whoami)

This could be very useful:

  • To migrate users’ private views and subsets from one environment to another.

  • To write a script that is security-aware (extracting data with specific user access).

  • When testing security with Python.

Support for Windows authentication

With the latest addition of security mode 3 (IntegratedSecurityMode3), TM1py supports now all security mode (from 1 to 5).

When creating a new TM1Service object, you just need to add integrated_login=True:

tm1 = TM1Service(address=servername, port=instanceport, ssl=True, integrated_login=True)

Write even faster to a cube

A new function was added to the TM1Service, it is called write. The function will execute unbound processes (when use_ti=True) to load the data from a cell set in to the cube:

with TM1Service(address="", port=12354, ssl=True, user="admin", password="apple") as tm1:    cells = dict()    cells["e1", "e1"] = 1    cells["e2", "e2"] = 2    tm1.cells.write("c1", cells, use_ti=True)

Support for sandboxes

A new object called Sandbox has been added. With this new object, it is now possibe to create and delete sandboxes.

with TM1Service(address="", port=12354, ssl=True, user="admin", password="apple") as tm1:    sandbox = Sandbox(name="My Sandbox")    tm1.sandboxes.create(sandbox)

To write data into a sandbox, you will need to add the parameter sandbox_name to the write function as below.

tm1.cells.write(cube_name, cells, sandbox_name="My Sandbox")

To retrieve data from a sandbox, you will need to add the parameter sandbox_name as below:

df = tm1.cells.execute_mdx_dataframe(mdx, sandbox_name="My Sandbox")

Load data from a data frame

A new function called write_dataframe has been added to facilitate loading data into a cube from a data frame. No need to convert the dataframe into a cellset anymore, just call the write_dataframe function as below:

with TM1Service(address="", port=12354, ssl=True, user="admin", password="apple") as tm1:    df = pd.DataFrame({        'd1': ['e1', 'e2'],        'd2': ['e1', 'e2'],        'Value': [1, 2]})    tm1.cells.write_dataframe('c1', df)

and much more…

A complete list of all enhancements and fixes can be found in the TM1py 1.6 Release Notes available on GitHub.

READ MORE:

Related content

Loading related content