cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
190 stars 109 forks source link

Finding LastDataUpdate in Cube Metadata #177

Closed jwk019 closed 5 years ago

jwk019 commented 5 years ago

Hi There -- I'm trying to retrieve the cube metadata value for LastDataUpdate via tm1py; I know I can hit it via the API: for example http://server123.org:1234/api/v1/Cubes('TheCube') will present a metadata dictionary, one of which keys is 'LastDataUpdate'.

But I have not found the module/method/key from which I can pull this value via TM1py. I'm happy to be enlightened with a direct answer, or one that helps me learn how to drill down through TM1py modules to find it. I've tried various imports of modules, and dir(this) and dir(that), to no avail.

Thanks to anyone who can help! jwk

MariusWirtz commented 5 years ago

Hi,

we don't have a method in TM1py to retrieve this information yet.

I think a good way to implement it would be to add a method to the CubeService like:

def get_last_data_update(self, cube_name)

Would that work for you ? I can add this method in the coming days to the TM1py library (unless you want to do it yourself) and update this thread. Then you will be able to use it like this:

from TM1py.Services import TM1Service

ADDRESS = '10.77.19.10'
PORT = 12354
USER = 'admin'
PASSWORD = 'YXBwbGU='
SSL = True
DECODE_B64 = True

with TM1Service(address=ADDRESS, port=PORT, user=USER, password=PASSWORD, ssl=SSL, decode_b64=DECODE_B64) as tm1:

    timestamp = tm1.cubes.get_last_data_update("The Cube")