-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating a dimension "}ElementAttributes_example" switches an alias attribute into a text attribute #1202
Comments
Hi @abetschenIBM, I recommend using the data frame functions like below instead. With the By default, existing attribute types are not changed. If you want TM1py to update existing attribute types, you must pass from TM1py import TM1Service
v11_params = {...}
v12_params = {...}
with TM1Service(**v11_params) as tm1:
df = tm1.elements.get_elements_dataframe(
dimension_name="Global Account Reporting",
hierarchy_name="Global Account Reporting",
skip_consolidations=False,
skip_parents=False,
attribute_suffix=True,
element_type_column="ElementType")
print(df.head(25).to_markdown())
with TM1Service(**v12_params) as tm1:
tm1.hierarchies.update_or_create_hierarchy_from_dataframe(
dimension_name="Global Account Reporting",
hierarchy_name="Global Account Reporting",
df=df) |
Hi Marius, After a deeper look and analysis, I was able to reproduce the error and found other side effects. But 1st things 1st, here is what I did (hope this description will help other avoid similar issues; may be, it should have been clear to me, that what I did was not a good idea): Case description: need to update the attribute of a dimension but not the content of the dimension (i.e. dimension content is different in Dev than in Test). Additionally a couple of the new attributes have specially configured to allow a date picker (https://community.ibm.com/community/user/businessanalytics/blogs/svetlana-pestsova/2022/06/10/tips-how-to-enable-the-calendar-picker-for-paw-cub) =>
So I performed the following to add the new attributes
Since thee new attributes were the 1st one that needed the "Format" attribute, I performed the following, thinkin it would add the "Format" attribute
This last step, is the one that creates the issues. It did create the Format attribute but after that step the following changed:
Not sure if this is "normal behavior" after the tm1py scripts that I ran, but it certainly not what I expected. If it is not normal then I am not sure how to determine if the issue lies with TM1 REST API or tm1py. We are working on restoring the aliases and the cube "}ElementAttributes_dim_name". If anyone has better deployment strategies and best practices or suggestions (PAasS on AWS / TM1v12), and is willing to share, that would be much appreciated. @MariusWirtz We tried to use your suggestion but we encountered an error message. One of my colleague is looking into why. |
I see. Yes. If you use the To work with from TM1py import TM1Service, ElementAttribute
tm1_params = {
"address": "localhost",
"port": 12354,
"user": "admin",
"password": "apple",
"ssl": True
}
with TM1Service(**tm1_params) as tm1:
tm1.elements.add_element_attributes(
dimension_name="}ElementAttributes_Dimension",
hierarchy_name="}ElementAttributes_Dimension",
element_attributes=[
ElementAttribute("New Alias Attribute", "Alias"),
ElementAttribute("New Format Attribute", "String"),
ElementAttribute("New Numeric Attribute", "Nummeric"),
]
) |
Describe the bug
When updating a dimension (i.e. }ElementAttributes_example) using the code below, it converts an alias attribute into a text attribute wrecking havoc with websheets relying on these aliases.
To Reproduce
dimension_src = tm1_src.dimensions.get(dimension_name=sdim_name)
dimension_tgt = tm1_tgt.dimensions.get(dimension_name=sdim_name)
tm1_tgt.dimensions.update_or_create(dimension_src)
Expected behavior
I would expect that when updating a dimension, it would add the new attributes and keep the current attribute type as is.
Version
TM1py [2.0.4]
TM1 Server Version: [12.4.4]
Additional context
Add any other context about the problem here.
BR
Andre
The text was updated successfully, but these errors were encountered: