Skip to content
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

Get default element of a hierarchy without need to allocate hierarchy in memory #95

Closed
pbuncik opened this issue Feb 5, 2019 · 1 comment
Assignees
Milestone

Comments

@pbuncik
Copy link
Contributor

pbuncik commented Feb 5, 2019

Hi,
It would be a great feature to add a function to return name of a default member in a hierarchy without actually allocating that hierarchy in memory as python representation of the whole hierarchy is not necessary for such request. The reason is that default member might be queried straight by HierarchyService to save resources and time for such query.
I'm currently using following code to get default member of a dimension hierarchy:

dim_hier = tm1_source.dimensions.hierarchies.get(dim_name_simple, dim_name_simple)
value = dim_hier.default_member

However memory is allocated not only for default member, but also for all elements in that hierarchy - this means to spend memory and time especially in cases when hierarchy contains thousands of elements.

@MariusWirtz MariusWirtz self-assigned this Feb 5, 2019
@MariusWirtz
Copy link
Collaborator

MariusWirtz commented Feb 5, 2019

Hi @pbuncik,

makes sense! I will add two new functions to the HierarchyService:

get_default_member(dimension_name, hierarchy_name)

and

update_default_member(dimension_name, hierarchy_name, member_name)

MariusWirtz added a commit to MariusWirtz/TM1py that referenced this issue Feb 5, 2019
- get_default_member
- update_default_member
@MariusWirtz MariusWirtz added this to the 1.3.0 milestone Feb 6, 2019
MariusWirtz added a commit to MariusWirtz/TM1py that referenced this issue Feb 17, 2019
- get_default_member
- update_default_member
MariusWirtz added a commit to MariusWirtz/TM1py that referenced this issue Feb 17, 2019
- get_default_member
- update_default_member
MariusWirtz added a commit to MariusWirtz/TM1py that referenced this issue Feb 17, 2019
- get_default_member
- update_default_member
@vviau vviau closed this as completed in 691de45 Feb 18, 2019
vviau added a commit that referenced this issue Feb 18, 2019
Two new methods in HierarchyService. Fixes #95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants