mstrio > project_objects > datasets > olap_cube

class mstrio.project_objects.datasets.olap_cube.OlapCube(connection, id, name=None, instance_id=None, parallel=True, progress_bar=True, show_expression_as=ExpressionFormat.TREE, show_filter_tokens=False)

Bases: ModelVldbMixin, _Cube

Manage single table cube - according to EnumDSSXMLObjectSubTypes its subtype is 776 (DssXmlSubTypeReportCube). It inherits all properties from Cube.

Parameters:
  • connection (Connection) –

  • id (str) –

  • name (str | None) –

  • instance_id (str | None) –

  • parallel (bool) –

  • progress_bar (bool) –

  • show_expression_as (ExpressionFormat | str) –

  • show_filter_tokens (bool) –

connection

Strategy One connection object returned by connection.Connection().

id

Identifier of a pre-existing cube.

Type:

str

instance_id

Identifier of a cube instance if already initialized, None by default.

Type:

str

name

Name of the OlapCube.

Type:

str

size

Size of cube.

Type:

int

status

Status of cube.

Type:

int

path

Full path of the cube on environment.

Type:

str

owner_id

ID of cube’s owner.

Type:

str

attributes

All attributes of cube.

Type:

list

metrics

All metrics of cube.

Type:

list

attr_elements

All attributes elements of cube.

Type:

list

selected_attributes

IDs of filtered attributes.

Type:

list

selected_metrics

IDs of filtered metrics.

Type:

list

selected_attr_elements

IDs of filtered attribute elements.

Type:

list

dataframe

Content of a cube extracted into a Pandas DataFrame.

Type:

DataFrame

template

Template defining OLAP Cube structure with references to attributes in rows and to metrics in columns.

Type:

Template

filter

Filtering element for OLAP Cube, needs to be in either ‘tree’ or ‘tokens’ format. If both are provided, only ‘tree’ is used.

Type:

Expression

options

Options specifying the behavior of cube. Includes possibilities for setting languages, refresh of data and partitioning by attribute.

Type:

CubeOptions

advanced_properties

Properties containing metric join type for every metric and attribute join type for every attribute provided in the template.

Type:

AdvancedProperties

time_based_settings

Settings of timezone and calendar objects specified with references by ID.

Type:

TimeBasedSettings

show_expression_as

Specify how expressions should be presented, default ‘ExpressionFormat.TREE’. Available values: - ExpressionFormat.TREE.

(expression is returned in text and tree formats)

  • ExpressionFormat.TOKENS.

    (expression is returned in text and tokens formats)

Type:

ExpressionFormat

show_filter_tokens

Specify whether ‘filter’ is returned in ‘tokens’ format, along with text and tree formats, default False. - If omitted or False, only text and tree formats are

returned.

  • If True, all text, ‘tree’ and tokens formats are returned.

Type:

bool

acl_add(rights, trustees, denied=False, inheritable=None, propagate_to_children=None, propagation_behavior=None)

Add Access Control Element (ACE) to the object ACL.

Note

To add rights for the Root Folder and the Freeform Objects, apply the required rights for these folders:

  • Root Folder: D43364C684E34A5F9B2F9AD7108F7828

  • Freeform Objects: 93D8CF3849C1F85DC1A48E8B9E4271F1

Argument propagate_to_children is used only for objects with type ObjectTypes.FOLDER.

Parameters:
  • rights (int | Rights | AggregatedRights) – The degree to which the user or group is granted or denied access to the object. The available permissions are defined in Rights and AggregatedRights Enums

  • trustees (list[UserOrGroup] | UserOrGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE for

  • denied (bool) – flag to indicate granted or denied access to the object

  • inheritable (bool | None) – Applies only to folders. If set, any objects placed in the folder inherit the folder’s entry in the ACL.

  • propagate_to_children (bool | None) – used for folder objects only, default value is None, if set to True/False adds propagateACLToChildren keyword to the request body and sets its value accordingly

  • propagation_behavior (PropagationBehavior | str | None) – Behavior of ACL propagation to children.

  • self (Entity) –

Return type:

None

Examples

>>> obj.acl_add(rights=Rights.BROWSE | Rights.EXECUTE,
>>>             trustees=user_obj, denied=True)
acl_alter(rights, trustees, denied=False, inheritable=None, propagate_to_children=None, propagation_behavior=None)

Alter an existing Access Control Element (ACE) of the object ACL.

Note

To alter rights for the Root Folder and the Freeform Objects, change the required rights for these folders:

  • Root Folder: D43364C684E34A5F9B2F9AD7108F7828

  • Freeform Objects: 93D8CF3849C1F85DC1A48E8B9E4271F1

Argument propagate_to_children is used only for objects with type ObjectTypes.FOLDER.

Parameters:
  • rights (int | Rights | AggregatedRights) – The degree to which the user or group is granted or denied access to the object. The available permissions are defined in Rights and AggregatedRights Enums

  • trustees (list[UserOrGroup] | UserOrGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE for

  • denied (bool) – flag to indicate granted or denied access to the object

  • inheritable (bool | None) – Applies only to folders. If set, any objects placed in the folder inherit the folder’s entry in the ACL.

  • propagate_to_children (bool | None) – used for folder objects only, default value is None, if set to True/False adds propagateACLToChildren keyword to the request body and sets its value accordingly

  • propagation_behavior (PropagationBehavior | str | None) – Behavior of ACL propagation to children.

  • self (Entity) –

Return type:

None

Examples

>>> obj.acl_alter(rights=Rights.BROWSE | Rights.EXECUTE,
>>>               trustees=user_obj, denied=True)
acl_remove(rights, trustees, denied=False, inheritable=None, propagate_to_children=None, propagation_behavior=None)

Remove Access Control Element (ACE) from the object ACL.

Note

To remove rights from the Root Folder and the Freeform Objects, remove them from these folders:

  • Root Folder: D43364C684E34A5F9B2F9AD7108F7828

  • Freeform Objects: 93D8CF3849C1F85DC1A48E8B9E4271F1

Argument propagate_to_children is used only for objects with type ObjectTypes.FOLDER.

Parameters:
  • rights (int | Rights | AggregatedRights) – The degree to which the user or group is granted or denied access to the object. The available permissions are defined in Rights and AggregatedRights Enums

  • trustees (list[UserOrGroup] | UserOrGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE for

  • denied (bool) – flag to indicate granted or denied access to the object

  • inheritable (bool | None) – Applies only to folders. If set, any objects placed in the folder inherit the folder’s entry in the ACL.

  • propagate_to_children (bool | None) – used for folder objects only, default value is None, if set to True/False adds propagateACLToChildren keyword to the request body and sets its value accordingly

  • propagation_behavior (PropagationBehavior | str | None) – Behavior of ACL propagation to children.

  • self (Entity) –

Return type:

None

Examples

>>> obj.acl_remove(rights=Rights.BROWSE | Rights.EXECUTE,
>>>                trustees=user_obj, denied=True)
add_translation(translations)

Adds translations to the Object.

Parameters:
  • translations (list[OperationData]) – list of translations to be added to the Object

  • self (Entity) –

Returns:

A list of translations for the Object.

Return type:

list[’Translation’]

alter(name=None, description=None, abbreviation=None, hidden=None, comments=None, owner=None, template=None, filter=None, options=None, time_based_settings=None)

Alter OLAP Cube properties by providing new name, description, abbreviation, template, filter, options or time_based_settings parameters.

Note

All types of expressions can be represented in the form of tokens, but some expressions with type predicate are yet not supported to be used for creation or modification in tokens form. For example: ‘expression_nodes.ElementListPredicate’ or ‘expression_nodes.FilterQualificationPredicate’ and some cases other involving embedded objects. Expected errors while be thrown in such cases.

Parameters:
  • name (str, optional) – New name for the OLAP Cube.

  • description (str, optional) – New description for the OLAP Cube.

  • abbreviation (str, optional) – New abbreviation for the OLAP Cube.

  • hidden (bool | None) – Specifies whether the OLAP Cube is hidden

  • comments (str | None) – New long description of the OLAP Cube

  • owner (str | User | None) – (str, User, optional): Owner of the OLAP Cube

  • template (Template, dict, str, optional) – Template defining OLAP Cube structure with references to attributes in rows and to metrics in columns.

  • filter (Expression, dict, optional) – Filtering element for OLAP Cube, needs to be in either ‘tree’ or ‘tokens’ format. If both are provided, only ‘tree’ is used.

  • options (CubeOptions, dict, optional) – Options specifying the behavior of cube. Includes possibilities for setting languages, refresh of data and partitioning by attribute.

  • time_based_settings (TimeBasedSettings, dict, optional) – Settings of timezone and calendar objects specified with references by ID.

Raises:
  • ValueError – When arguments for altering were not provided or given template is empty.

  • helper.IServerError – When there was an error on IServer side when trying to alter an OLAP Cube.

Returns:

None

Return type:

None

alter_translation(translations)

Alters translations of the Object.

Parameters:
  • translations (list[OperationData]) – list of translations to be added to the Object

  • self (Entity) –

Return type:

None

alter_vldb_settings(names_to_values)

Alter VLDB settings according to given name to value pairs.

Note

Only common value type conversion will be done by default, such as int->float, bool->int, int->bool and only if that is possible according to interval of allowed values, error will be thrown in other cases.

Parameters:

names_to_values (dict[str, str | int | float | bool]) – Dict with VlDB settings names as keys and newly requested to set values as dictionary values. As VLDB Setting name you can provide both: key or display name.

Raises:
  • ValueError – If there are no VldbSetting objects for some provided names or names and values are not provided or some of provided values will not be possible to set.

  • TypeError – If some of provided values to set have wrong type, different from type of default VLDB setting value.

Returns:

None

Return type:

None

apply_filters(attributes=None, metrics=None, attr_elements=None, operator='In')

Apply filters on the cube’s objects.

Filter by attributes, metrics and attribute elements.

Parameters:
  • attributes (list or None, optional) – ids of attributes to be included in the filter. If list is empty, no attributes will be selected and metric data will be aggregated.

  • metrics (list or None, optional) – ids of metrics to be included in the filter. If list is empty, no metrics will be selected.

  • attr_elements (list or None, optional) – attribute elements to be included in the filter.

  • operator (str, optional) – a str flag used to specify if the attribute elements selected inside the filter should be included or excluded. Allowed values are: ‘In’, ‘NotIn’.

Return type:

None

classmethod available_attribute_forms(connection, basic_info_only=True, to_dataframe=False)

Get all attribute forms available on I-Server. :param connection: Strategy One connection object returned by

connection.Connection()

Parameters:
  • basic_info_only (boolean, optional) – When True (default value) only values of id, name and type will be returned for each attribute form. When False, then all properties of each attribute form will be returned.

  • to_dataframe (bool) – When False (default value) then attribute forms are returned as a list of dictionaries. When True then attribute forms are returned as Pandas ‘DataFrame’.

  • connection (Connection) –

Returns:

List of attribute forms or attribute forms as Pandas DataFrame.

Return type:

list[dict] | list[pandas.core.frame.DataFrame]

classmethod available_attributes(connection, basic_info_only=True, to_dataframe=False)

Get all attributes available on I-Server. :param connection: Strategy One connection object returned by

connection.Connection()

Parameters:
  • basic_info_only (boolean, optional) – When True (default value) only values of id, name and type will be returned for each attribute. When False, then all properties of each attribute will be returned.

  • to_dataframe (bool) – When False (default value) then attributes are returned as a list of dictionaries. When True then attributes are returned as Pandas ‘DataFrame’.

  • connection (Connection) –

Returns:

List of attributes or attributes as Pandas DataFrame.

Return type:

list[dict] | list[pandas.core.frame.DataFrame]

classmethod available_metrics(connection, basic_info_only=True, to_dataframe=False)

Get all metrics available on I-Server. :param connection: Strategy One connection object returned by

connection.Connection()

Parameters:
  • basic_info_only (boolean, optional) – When True (default value) only values of id, name and type will be returned for each metric. When False, then all properties of each metric will be returned.

  • to_dataframe (bool) – When False (default value) then metrics are returned as a list of dictionaries. When True then metrics are returned as Pandas ‘DataFrame’.

  • connection (Connection) –

Returns:

List of attributes or attributes as Pandas DataFrame.

Return type:

list[dict] | list[pandas.core.frame.DataFrame]

classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)

Creates multiple objects from a list of dictionaries. For each dictionary provided the keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in the object’s _FROM_DICT_MAP.

Parameters:
  • cls (T) – Class (type) of the objects that should be created.

  • source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects will be constructed.

  • connection (Connection, optional) – A MSTR Connection object. Defaults to None.

  • to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.

  • with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.

Returns:

A list of objects of type T.

Return type:

T

clear_filters()

Clear previously set filters, allowing all attributes, metrics, and attribute elements to be retrieved.

Return type:

None

classmethod create(connection, name, folder_id, description=None, template=None, filter=None, options=None, advanced_properties=None, time_based_settings=None, template_cube=None, show_expression_as=ExpressionFormat.TREE, show_filter_tokens=False)

Create an OLAP Cube by defining its name, destination folder ID, description, attributes and metrics or template from ‘Template’ class to specify structure of cube additionally providing filter, options, advanced properties and time based settings.

Note

All types of expressions can be represented in the form of tokens, but some expressions with type predicate are yet not supported to be used for creation or modification in tokens form. For example: ‘expression_nodes.ElementListPredicate’ or ‘expression_nodes.FilterQualificationPredicate’ and some cases other involving embedded objects. Expected errors while be thrown in such cases.

Parameters:
  • connection (Connection) – Strategy One connection object returned by connection.Connection().

  • name (str) – OLAP Cube name.

  • folder_id (str) – ID of the folder where OLAP Cube should be saved.

  • description (str, optional) – OLAP Cube description.

  • template (Template, dict, optional) – Template defining OLAP Cube structure with references to attributes in rows and to metrics in columns.

  • filter (Expression, dict, optional) – Filtering element for OLAP Cube, needs to be in either ‘tree’ or ‘tokens’ format. If both are provided, only ‘tree’ is used.

  • options (CubeOptions, dict, optional) – Options specifying the behavior of cube. Includes possibilities for setting languages, refresh of data and partitioning by attribute.

  • advanced_properties (AdvancedProperties, dict, optional) – Properties containing metric join type for every metric and attribute join type for every attribute provided in the template.

  • time_based_settings (TimeBasedSettings, dict, optional) – Settings of timezone and calendar objects specified with references by ID.

  • template_cube (OlapCube, str, optional) – If specified, a newly created OLAP Cube will inherit its template from a provided OlapCube object. A filter of the referenced cube will be used in the case when a ‘filter’ parameter was not specified.

  • show_expression_as (ExpressionFormat, str, optional) –

    Specify how expressions should be presented, default ‘ExpressionFormat.TREE’. Available values: - None.

    (expression is returned in ‘text’ format)

    • ExpressionFormat.TREE or tree.

      (expression is returned in text and tree formats)

    • ExpressionFormat.TOKENS or tokens.

      (expression is returned in text and tokens formats)

  • show_filter_tokens (bool, optional) –

    Specify whether ‘filter’ is returned in ‘tokens’ format, along with text and tree formats, default False. - If omitted or False, only text and tree formats are

    returned.

    • If True, all text, ‘tree’ and tokens formats are returned.

Raises:

ValueError – When provided template is empty.

Returns:

Newly created OLAP Cube or None in case of incorrectly provided

arguments.

Return type:

OlapCube | None

create_shortcut(target_folder_id=None, target_folder_path=None, target_folder=None, project_id=None, project_name=None, project=None, to_dictionary=False)

Create a shortcut to the object.

Parameters:
  • target_folder_id (str, optional) – ID of the target folder. Target folder must be specified, but target_folder_id may be substituted with target_folder_path or target_folder.

  • target_folder_path (str, optional) – Path to the target folder, e.g. ‘/MicroStrategy Tutorial/Public Objects’. May be used instead of target_folder_id.

  • target_folder (Folder, optional) – Target folder object. May be used instead of target_folder_id.

  • project_id (str, optional) – ID of the target project of the new shortcut. The project may be specified by either project_id, project_name or project. If the project is not specified in either way, the project from the connection object is used.

  • project_name (str, optional) – Name of the target project. May be used instead of project_id.

  • project (Project, optional) – Project object specifying the target project. May be used instead of project_id.

  • to_dictionary (bool, optional) – If True, the method will return a dictionary with the shortcut’s properties instead of a Shortcut object. Defaults to False.

Return type:

Shortcut

delete(force=False)

Delete object.

Parameters:
  • force (bool) – If True, then no additional prompt will be shown before deleting object.

  • self (Entity) –

Returns:

True on success. False otherwise.

Return type:

bool

export_sql_view()

Export SQL View of an OLAP Cube. :returns: SQL View of an OLAP Cube.

fetch(attr=None)

Fetch the latest object’s state from the I-Server.

Note

This method can overwrite local changes made to the object.

Parameters:
  • attr (Optional[str]) – Attribute name to be fetched. If not specified

  • dictionary. (it will use all getters specified in _API_GETTERS) –

  • None. (Defaults to) –

Raises:

ValueError – If attr cannot be fetched.

Return type:

None

fetch_vldb_settings()
classmethod from_dict(source, connection, to_snake_case=True, with_missing_value=False)
Overrides Dictable.from_dict() to instantiate an object from

a dictionary without calling any additional getters.

Parameters:
  • cls (T) – Class (type) of an object that should be created.

  • source (dict[str, Any]) – a dictionary from which an object will be constructed.

  • connection (Connection) – A Strategy One Connection object.

  • to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case, default True.

  • with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.

Returns:

An object of type T.

Return type:

T

get(name)

Get object’s attribute by its name.

get_caches()

Get list of caches of the cube.

Returns:

list of caches of the cube

Return type:

list[’CubeCache’]

list_acl(to_dataframe=False, to_dictionary=False, **filters)

Get Access Control List (ACL) for this object. Optionally filter ACLs by specifying filters.

Parameters:
  • to_dataframe (bool, optional) – if True, return datasets as pandas DataFrame

  • to_dictionary (bool, optional) – if True, return datasets as dicts

  • **filters – Available filter parameters: [deny, type, rights, trustee_id, trustee_name, trustee_type, trustee_subtype, inheritable]

Return type:

DataFrame | list[dict | mstrio.utils.acl.ACE]

Examples

>>> list_acl(deny=True, trustee_name="John")
list_attribute_forms()

Listing forms for every attribute specified in template. If default forms for attribute were used, string indicating that will be returned instead of forms.

Returns:

List with dicts containing attribute name as key and forms as values or string indicating that they are default.

Return type:

list[dict[list[tuple], str]]

list_dependencies(project=None, name=None, pattern=4, domain=2, object_types=None, used_by_recursive=False, root=None, root_path=None, limit=None, offset=None, results_format='LIST', to_dictionary=True, **filters)

List list_dependencies of an object.

Parameters:
  • project (string) – Project object or ID

  • name (string) – Value the search pattern is set to, which will be applied to the names of object types being searched. For example, search for all report objects (type) whose name begins with (pattern) B (name).

  • pattern (integer or enum class object) – Pattern to search for, such as Begin With or Exactly. Possible values are available in ENUM mstrio.object_management.SearchPattern. Default value is CONTAINS (4).

  • domain (integer or enum class object) – Domain where the search will be performed, such as Local or Project. Possible values are available in ENUM mstrio.object_management.SearchDomain. Default value is PROJECT (2).

  • root (string, optional) – Folder ID of the root folder where the search will be performed.

  • root_path (str, optional) –

    Path of the root folder in which the search will be performed. Can be provided as an alternative to root parameter. If both are provided, root is used.

    the path has to be provided in the following format:
    if it’s inside of a project, example:

    /MicroStrategy Tutorial/Public Objects/Metrics

    if it’s a root folder, example:

    /CASTOR_SERVER_CONFIGURATION/Users

  • class (object_types(enum class object or integer or list of enum) – objects or integers): Type(s) of object(s) to be searched, such as Folder, Attribute or User. Possible values available in ENUMs mstrio.types.ObjectTypes and mstrio.types.ObjectSubTypes

  • used_by_recursive (boolean, optional) – Control the Intelligence server to also find objects that are used by the given objects indirectly. Default value is false.

  • results_format (SearchResultsFormat) – either a list or a tree format

  • to_dictionary (bool) – If False returns objects, by default (True) returns dictionaries.

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

  • offset (int) – Starting point within the collection of returned results. Used to control paging behavior. Default is 0.

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

  • self (Entity) –

  • object_types (TypeOrSubtype | None) –

Returns:

list of objects or list of dictionaries

list_dependents(project=None, name=None, pattern=4, domain=2, object_types=None, uses_recursive=False, root=None, root_path=None, limit=None, offset=None, results_format='LIST', to_dictionary=True, **filters)

List dependents of an object.

Parameters:
  • project (string) – Project object or ID

  • name (string) – Value the search pattern is set to, which will be applied to the names of object types being searched. For example, search for all report objects (type) whose name begins with (pattern) B (name).

  • pattern (integer or enum class object) – Pattern to search for, such as Begin With or Exactly. Possible values are available in ENUM mstrio.object_management.SearchPattern. Default value is CONTAINS (4).

  • domain (integer or enum class object) – Domain where the search will be performed, such as Local or Project. Possible values are available in ENUM mstrio.object_management.SearchDomain. Default value is PROJECT (2).

  • root (string, optional) – Folder ID of the root folder where the search will be performed.

  • root_path (str, optional) –

    Path of the root folder in which the search will be performed. Can be provided as an alternative to root parameter. If both are provided, root is used.

    the path has to be provided in the following format:
    if it’s inside of a project, example:

    /MicroStrategy Tutorial/Public Objects/Metrics

    if it’s a root folder, example:

    /CASTOR_SERVER_CONFIGURATION/Users

  • class (object_types(enum class object or integer or list of enum) – objects or integers): Type(s) of object(s) to be searched, such as Folder, Attribute or User. Possible values available in ENUMs mstrio.types.ObjectTypes and mstrio.types.ObjectSubTypes

  • uses_recursive (boolean) – Control the Intelligence server to also find objects that use the given objects indirectly. Default value is false.

  • results_format (SearchResultsFormat) – either a list or a tree format

  • to_dictionary (bool) – If False returns objects, by default (True) returns dictionaries.

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

  • offset (int) – Starting point within the collection of returned results. Used to control paging behavior. Default is 0.

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

  • self (Entity) –

  • object_types (TypeOrSubtype | None) –

Returns:

list of objects or list of dictionaries

list_properties()

List all properties of the object.

Return type:

dict

list_translations(languages=None, to_dictionary=False)

Lists translations for the Object.

Parameters:
  • languages (list, optional) –

    list of languages to list the translations for, only translations from these languages will be listed. Languages in the list should be one of the following:

    • lcid attribute of the language

    • ID of the language

    • Language class object

  • to_dictionary (bool, optional) – If True returns dict, by default (False) returns Translation objects

  • self (Entity) –

Returns:

A list of dictionaries representing translations for the Object or a list of Translation Objects.

Return type:

list[’Translation’] | list[dict]

list_vldb_settings(set_names=None, names=None, groups=None, to_dictionary=False, to_dataframe=False)

List VLDB settings according to given parameters.

Parameters:
  • set_names (list[str], optional) – List of names of VLDB settings sets.

  • names (list[str], optional) – List of names of VLDB settings.

  • groups (list[int], list[str], optional) – List of group names or ids.

  • to_dictionary (bool, optional) – If True, return VldbSetting objects as list of dicts, default False.

  • to_dataframe (bool, optional) – If True, return VldbSetting objects as pandas DataFrame, default False.

Raises:
  • ValueError – If there are no VldbSetting objects with given parameters or some of the parameters are incorrectly specified.

  • TypeError – If groups list parameter consists of objects of different types.

Returns:

Dict with settings names as keys and VldbSetting objects as values.

Return type:

dict[str, mstrio.utils.vldb_mixin.VldbSetting] | DataFrame

print()

Pretty Print all properties of the object.

Return type:

None

publish()

Publish an OLAP Cube. Request to publish an OLAP Cube is an asynchronous operation, so the result of it can be seen after calling method refresh_status() inherited from Cube class. :returns: Job instance.

Return type:

Job

refresh()

Refresh a Cube without interaction. This method sends an asynchronous request to refresh a Cube, which results in the creation of a Job instance. The result of the operation can be monitored by checking the status of the returned Job instance or by calling the refresh_status() method on the Cube. Refreshing a Cube is effectively the same as republishing it. :returns: An instance representing the asynchronous job created for the

Cube refresh operation.

Return type:

Job

refresh_status()

Refresh cube’s status and show which states it represents.

Return type:

None

remove_partition_attribute()

Remove assigned to OLAP Cube partition attribute.

Returns:

None

Return type:

None

remove_translation(translations)

Removes translations from the Object.

Parameters:
  • translations (list[OperationData]) – list of translations to be added to the Object

  • self (Entity) –

Return type:

None

reset_vldb_settings(set_names=None, names=None, groups=None, force=False)

Reset VLDB settings specified by parameters to its default values. If call was without parameters then additional prompt will be shown.

Parameters:
  • set_names (list[str], optional) – List of names of VLDB setting sets.

  • names (list[str], optional) – List of names of VLDB settings.

  • groups (list[int], list[str], optional) – List of groups names or ids.

  • force (bool) – (bool, optional): If True, no additional prompt will be shown before resetting in case when all other arguments are not provided, default False.

Raises:
  • ValueError – If there are no VldbSetting objects with given parameters or some of the parameters are incorrectly specified.

  • TypeError – If groups list parameter consists of objects of different types.

Returns:

None

Return type:

None

set_partition_attribute(attribute)

Assign new partition attribute to OLAP Cube.

Parameters:

attribute (Attribute, str) – Partition attribute that will be set, could be provided by ID or with ‘Attribute’ object.

Returns:

None

Return type:

None

show_status()

Show which states are represented by cube’s status.

Return type:

list[str]

classmethod to_csv(objects, name, path=None, properties=None)

Exports MSTR objects to a csv file.

Optionally, saves only the object properties specified in the properties parameter.

Parameters:
  • objects (T | list[T]) – List of objects of the same type that

  • exported. (will be) –

  • name (str) – The name of the csv file ending with ‘.csv’

  • path (Optional[str], optional) – A path to the directory where the file will be saved. Defaults to None.

  • properties (Optional[list[str]], optional) – A list of object’s attribute names that should be included in the exported file. Defaults to None.

Raises:
  • TypeError – If objects is not of type T or list of type T

  • objects.

Return type:

None

to_dataframe(limit=None, multi_df=False)

Extract contents of a cube into a Pandas DataFrame.

Parameters:
  • limit (None or int, optional) – Used to control data extract behavior. By default (None) the limit is calculated automatically, based on an optimized physical size of one chunk. Setting limit manually will force the number of rows per chunk. Depending on system resources, a higher limit (e.g. 50,000) may reduce the total time required to extract the entire dataset.

  • multi_df (bool, optional) – If True, return a list of data frames resembling the table structure of the cube. If False (default), returns one data frame.

Returns:

Pandas Data Frame containing the cube contents

to_dict(camel_case=True)

Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.

Parameters:

camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.

Returns:

A dictionary representation of object’s attributes and values.

By default, the dictionary keys are in camel case.

Return type:

dict

unpublish(force=False)

Unpublish Cube by removing all of its caches.

Parameters:

force (bool) – If True, then no additional prompt will be shown before deleting Cube.

Returns:

True when all of cube’s caches were deleted and it was successfully unpublished. False otherwise.

Return type:

bool

update_properties()

Save compatible local changes of the object attributes to the I-Server. Changes are retrieved from the self._altered_properties dictionary. After the process of update has finished, self._altered_properties is cleared. For this method to work properly, you must override the _alter_properties() method in a subclass.

Raises:

requests.HTTPError – If I-Server raises exception

Return type:

None

mstrio.project_objects.datasets.olap_cube.list_olap_cubes(connection, name=None, search_pattern=SearchPattern.CONTAINS, project_id=None, project_name=None, to_dictionary=False, limit=None, **filters)

Get list of OlapCube objects or dicts with them. Optionally filter cubes by specifying ‘name’. Optionally use to_dictionary to choose output format. Wildcards available for ‘name’:

? - any character * - 0 or more of any characters e.g. name = ?onny will return Sonny and Tonny

Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted. .. note:

When `project_id` is `None` and `project_name` is `None`,
then its value is overwritten by `project_id` from `connection` object.
Parameters:
  • connection (Connection) – Strategy One connection object returned by connection.Connection()

  • name (string, optional) – value the search pattern is set to, which will be applied to the names of olap cubes being searched

  • search_pattern (SearchPattern enum or int, optional) – pattern to search for, such as Begin With or Contains. Possible values are available in ENUM mstrio.object_management.SearchPattern. Default value is BEGIN WITH (4).

  • project_id (str, optional) – Project ID

  • project_name (str, optional) – Project name

  • to_dictionary (bool, optional) – If True returns dict, by default (False) returns OlapCube objects

  • limit (integer, optional) – limit the number of elements returned. If None all object are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘owner’, ‘ext_type’, ‘view_media’, ‘certified_info’]

Returns:

list with OlapCubes or list of dictionaries

Return type:

list[OlapCube] | list[dict]