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, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

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: mstrio.modeling.schema.user_hierarchy.user_hierarchy.ElementDisplayOption | str, filters: list[mstrio.modeling.schema.helpers.SchemaObjectReference] | list[dict] = None, limit: int | None = None)

Bases: 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: mstrio.modeling.schema.helpers.SchemaObjectReference | dict, child: mstrio.modeling.schema.helpers.SchemaObjectReference | dict)

Bases: 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: str | None = None, name: str | None = None)

Bases: Entity, CopyMixin, MoveMixin, DeleteMixin, TranslationMixin

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

hidden

Specifies whether the object is hidden

add_attribute(attribute: 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: 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: str = None, sub_type: str | mstrio.modeling.schema.user_hierarchy.user_hierarchy.UserHierarchySubType = None, attributes: list[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyAttribute] | list[dict] | None = None, use_as_drill_hierarchy: bool | None = None, description: str | None = None, is_embedded: bool = False, destination_folder_id: str | None = None, relationships: list[mstrio.modeling.schema.user_hierarchy.user_hierarchy.HierarchyRelationship] | list[dict] | None = None, hidden: bool | None = None, comments: str | None = 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

  • hidden (bool, optional) – Specifies whether the object is hidden. Default value: False.

  • comments (str, optional) – long description of the user hierarchy

classmethod create(connection: Connection, name: str, sub_type: str | mstrio.modeling.schema.user_hierarchy.user_hierarchy.UserHierarchySubType, destination_folder_id: str, attributes: 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: 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: 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: 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, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

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) 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’, ‘sub_type’]

Examples

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

Module contents