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
188 stars 108 forks source link

Not able to view element created from update_or_create_hierarchy_from_dataframe function in dimension even after refreshing server. #1166

Closed Mahimajain25 closed 3 hours ago

Mahimajain25 commented 4 hours ago

Hi Team,

I'm trying to create a dummy region dimension from Pandas data frame using update_or_create_hierarchy_from_dataframe function. issue is - dimension is created and elements is not visible in architect. But visible in Jupyter notebook.
Please note using the same user while creating dimension from tm1py and viewing in Architect.

Code:

with TM1Service(**config['tm1srv03']) as tm1:
    rest_service = tm1._tm1_rest
    #print(rest_service.version)
    hierarchy_service = HierarchyService(rest_service)
    dimension_name = 'Dummy_Region'
    hierarchy_name = 'RegionHierarchy'

    h1 = hierarchy_service.update_or_create_hierarchy_from_dataframe(dimension_name=dimension_name,hierarchy_name=hierarchy_name,df=df,element_type_column='ElementType',verify_unique_elements=True)
    #Dimension.add_hierarchy(dimension_name,hierarchy_name)
with TM1Service(**config['tm1srv03']) as tm1:
    a = tm1.hierarchies.exists(dimension_name,hierarchy_name)
    print(a)
    b= tm1.elements.exists(dimension_name,hierarchy_name,'Germany')
    print(b)
    dim_all = tm1.dimensions.get_all_names()
    ele = tm1.elements.get_element_names(dimension_name,hierarchy_name)
    ele1 = tm1.elements.get_element_names(dimension_name,'Dummy_Region')
    att = tm1.elements.get_alias_element_attributes(dimension_name,hierarchy_name)
    print(ele)
    print(att)
    security_service = tm1.security
    element_security = security_service.get_current_user()
    #print(element_security)
    h = tm1.dimensions.hierarchies.get_all_names(dimension_name)
   #tm1.dimensions.hierarchies.delete(dimension_name,'Dummy_Region')

    print(h)
    print(ele1)
  1. Output : True True ['France', 'Belgium', 'Germany', 'Europe', 'World'] ['Alias'] ['RegionHierarchy', 'Dummy_Region'] ['test']

  2. Please find screenshot of dataframe and dummy_region dimension attached.

    Dummy_Region Dataframe

Version

MariusWirtz commented 3 hours ago

You are creating an alternate hierarchy, but the old TM1 front ends (architect/perspectives) can't render alternate hierarchies in the server.

To see the created hierarchy use Arc or PAW https://code.cubewise.com/software/products/arc/

If you provide the same hierarchy_name as dimension_name you will see your creation in Architect/Perspectives.

macsir commented 3 hours ago

Yes, agreed. Just about to reply. :)

Get Outlook for iOShttps://aka.ms/o0ukef


From: Marius Wirtz @.> Sent: Tuesday, October 15, 2024 6:29:04 PM To: cubewise-code/tm1py @.> Cc: Subscribed @.***> Subject: Re: [cubewise-code/tm1py] Not able to view element created from update_or_create_hierarchy_from_dataframe function in dimension even after refreshing server. (Issue #1166)

You are creating an alternate hierarchy, but the old TM1 front ends (architect/perspectives) can't render alternate hierarchies in the server.

To see the created hierarchy use Arc or PAW https://code.cubewise.com/software/products/arc/

If you provide the same hierarchy_name as dimension_name you will see your creation in Architect/Perspectives.

— Reply to this email directly, view it on GitHubhttps://github.com/cubewise-code/tm1py/issues/1166#issuecomment-2413227682, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZQV7L3FALHSVZ4JSSD763Z3TG5BAVCNFSM6AAAAABP6SE56OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJTGIZDONRYGI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Mahimajain25 commented 3 hours ago

the same hierarchy_name as dimension_name you will see your creation in Architect/Perspectives.

Thank you @MariusWirtz for your help😊. I really Appreciate it. 👍 I'm able to view Hierarchy in Architect.