mstrio.modeling.schema.user_hierarchy package

Submodules

mstrio.modeling.schema.user_hierarchy.user_hierarchy module

class mstrio.modeling.schema.user_hierarchy.user_hierarchy.ElementDisplayOption(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

ALL_ELEMENTS = 'all_elements'
LIMITED_ELEMENTS = 'limited_elements'
NO_ELEMENTS = 'no_elements'
class mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyAttribute(object_id: str, entry_point: bool, name: str, element_display_option: Union[mstrio.modeling.schema.user_hierarchy.user_hierarchy.ElementDisplayOption, str], filters: Optional[Union[List[mstrio.modeling.schema.helpers.SchemaObjectReference], List[dict]]] = None, limit: Optional[int] = None)

Bases: mstrio.utils.helper.Dictable

Object that specifies the hierarchy attribute.

object_id

hierarchy attribute ID

name

name of the attribute

entry_point

whether this hierarchy attribute is an entry point

element_display_option

used to control element display for each hierarchy attribute, ElementDisplayOption enum

filters

the list of filters defined on this hierarchy attribute

limit

the element display limit when element_display_option is limited_elements

class mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyRelationship(parent: Union[mstrio.modeling.schema.helpers.SchemaObjectReference, dict], child: Union[mstrio.modeling.schema.helpers.SchemaObjectReference, dict])

Bases: mstrio.utils.helper.Dictable

Object that specifies the hierarchy relationship between hierarchy attributes.

parent

an information about an object representing a parent in a current hierarchy relationship, SchemaObjectReference object

child

an information about an object representing a child in a current hierarchy relationship, SchemaObjectReference object

class mstrio.modeling.schema.user_hierarchy.user_hierarchy.UserHierarchy(connection: Connection, id: Optional[str] = None, name: Optional[str] = None)

Bases: mstrio.utils.entity.Entity, mstrio.utils.entity.CopyMixin, mstrio.utils.entity.MoveMixin, mstrio.utils.entity.DeleteMixin

A unique abstraction of hierarchies above the System Hierarchy, which can contain an arbitrary number of attributes and paths between them. These User Hierarchies allow users to browse through the data and drill as required by business needs, as opposed to how the data is physically stored in the data source.

name

name of the user hierarchy

id

user hierarchy ID

description

description of the user hierarchy

sub_type

string literal used to identify the type of a metadata object, UserHierarchySubType enum

version

object version ID

ancestors

list of ancestor folders

type

object type, ObjectTypes enum

ext_type

object extended type, ExtendedType enum

date_created

creation time, DateTime object

date_modified

last modification time, DateTime object

owner

User object that is the owner

acg

access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

object access control list

version_id

the version number this object is currently carrying

use_as_drill_hierarchy

whether this user hierarchy is used as drill hierarchy, default True

is_embedded

if true indicates that the target object of this reference is embedded within this object, if this field is omitted (as is usual) then the target is not embedded.

path

the path of the object, read only

primary_locale

the primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”, read only

attributes

the list of user hierarchy attributes

relationships

the list of attribute relationships stored in the user hierarchy

destination_folder_id

a globally unique identifier used to distinguish between metadata objects within the same project

add_attribute(attribute: Union[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyAttribute, dict])

Add an attribute to an existing hierarchy.

Parameters

attribute – (HierarchyAttribute, dict): an attribute to be added to the hierarchy

add_relationship(relationship: Union[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyRelationship, dict])

Add a relationship to an existing hierarchy.

Parameters

relationship – (HierarchyRelationship, dict): a relationship to be added to the hierarchy

alter(name: Optional[str] = None, sub_type: Optional[Union[str, mstrio.modeling.schema.user_hierarchy.user_hierarchy.UserHierarchySubType]] = None, attributes: Optional[Union[List[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyAttribute], List[dict]]] = None, use_as_drill_hierarchy: Optional[bool] = None, description: Optional[str] = None, is_embedded: bool = False, destination_folder_id: Optional[str] = None, relationships: Optional[Union[List[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyRelationship], List[dict]]] = None)

Alter the user hierarchies properties.

Parameters
  • name (str, optional) – name of a user hierarchy

  • sub_type (str, enum, optional) – string literal used to identify the type of a metadata object, UserHierarchySubType enum

  • description (str, optional) – description of a user hierarchy

  • use_as_drill_hierarchy (bool, optional) – whether this user hierarchy is used as drill hierarchy

  • attributes (list, optional) – the list of attributes that do have any relationships currently

  • is_embedded (bool, optional) – if true indicates that the target object of this reference is embedded within this object

  • destination_folder_id (str, optional) – a globally unique identifier used to distinguish between objects within the same project

  • relationships (list, optional) – the list of attribute relationships stored in the system hierarchy

classmethod create(connection: Connection, name: str, sub_type: Union[str, mstrio.modeling.schema.user_hierarchy.user_hierarchy.UserHierarchySubType], destination_folder_id: str, attributes: Union[List[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyAttribute], List[dict]], use_as_drill_hierarchy: bool = True, description: str = None, is_embedded: bool = False, primary_locale: str = None, relationships: Union[List[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyRelationship], List[dict]] = None)

Create a new user hierarchy in a specific project.

Parameters
  • connection – MicroStrategy connection object returned by connection.Connection().

  • name (str) – name of a new user hierarchy.

  • sub_type (str, enum) – string literal used to identify the type of a metadata object, UserHierarchySubType enum

  • attributes (list) – the list of attributes that do have any relationships currently

  • destination_folder_id (str) – a globally unique identifier used to distinguish between metadata objects within the same project

  • use_as_drill_hierarchy (bool, optional) – whether this user hierarchy is used as drill hierarchy

  • description (str, optional) – optional description of a new user hierarchy

  • is_embedded (bool, optional) – if true indicates that the target object of this reference is embedded within this object

  • primary_locale (str, optional) – the primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”

  • relationships (list, optional) – the list of attribute relationships stored in the system hierarchy

Returns

UserHierarchy object

remove_attribute(attribute: Union[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyAttribute, dict])

Remove attribute from an existing user hierarchy.

Parameters

attribute – (HierarchyAttribute, dict): an attribute to be removed from the hierarchy

remove_relationship(relationship: Union[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyRelationship, dict])

Remove relationship from an existing user hierarchy.

Parameters

relationship – (HierarchyRelationship, dict): a relationship to be removed from the hierarchy

class mstrio.modeling.schema.user_hierarchy.user_hierarchy.UserHierarchySubType(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

DIMENSION_USER = 'dimension_user'
DIMENSION_USER_HIERARCHY = 'dimension_user_hierarchy'
mstrio.modeling.schema.user_hierarchy.user_hierarchy.list_user_hierarchies(connection: Connection, to_dictionary: bool = False, limit: int = None, **filters) Union[List[UserHierarchy], List[dict]]

Get list of UserHierarchy objects or dicts. Optionally filter the user hierarchies by specifying filters.

Parameters
  • connection – MicroStrategy connection object returned by connection.Connection()

  • to_dictionary – If True returns dict, by default (False) returns User Hierarchy objects.

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘date_created’, ‘date_modified’, ‘acg’]

Examples

>>> list_user_hierarchies(connection, name='hierarchy_name')

Module contents