mstrio > project_objects > datasets > cube

enum mstrio.project_objects.datasets.cube.CubeStates(value)

Bases: Enum

Valid values are as follows:

ACTIVE = <CubeStates.ACTIVE: 2>
DIRTY = <CubeStates.DIRTY: 16>
DIRTY_INFO = <CubeStates.DIRTY_INFO: 8>
FOREIGN = <CubeStates.FOREIGN: 2048>
IMPORTED = <CubeStates.IMPORTED: 1024>
LOAD_PENDING = <CubeStates.LOAD_PENDING: 128>
LOADED = <CubeStates.LOADED: 32>
PENDING_FOR_ENGINE = <CubeStates.PENDING_FOR_ENGINE: 512>
PERSISTED = <CubeStates.PERSISTED: 4>
PROCESSING = <CubeStates.PROCESSING: 1>
READY = <CubeStates.READY: 64>
RESERVED = <CubeStates.RESERVED: 0>
UNLOAD_PENDING = <CubeStates.UNLOAD_PENDING: 256>
UNKNOWN1 = <CubeStates.UNKNOWN1: 4096>
UNKNOWN2 = <CubeStates.UNKNOWN2: 8192>
UNKNOWN3 = <CubeStates.UNKNOWN3: 16384>

The Enum and its members also have the following methods:

classmethod show_status(status)

Show states of a cube calculated from numerical value of its state. Additionally list of those states’ names is returned.

Parameters:

status (integer) – numerical value of cube’s status

Returns:

List with names of cube’s states.

Return type:

list[str]

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

Get list of Cube objects (OlapCube or SuperCube) 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 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 (string, optional) – Project ID

  • project_name (str, optional) – Project name

  • to_dictionary (bool, optional) – If True returns dict, by default (False) returns SuperCube/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 and SuperCubes or list of dictionaries

Return type:

list[OlapCube | SuperCube] | list[dict]

mstrio.project_objects.datasets.cube.load_cube(connection, cube_id=None, cube_name=None, folder_id=None, folder_path=None, instance_id=None)

Load single cube specified by either ‘cube_id’ or both ‘cube_name’ and ‘folder_id’.

It is also possible to load cube by providing only cube_name, but in that case we may retrieve more than one cube as cube’s name is unique only within a folder.

instance_id is used only when a single cube is retrieved.

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

  • cube_id (string, optional) – ID of cube

  • cube_name (string, optional) – name of cube

  • folder_id (string, optional) – ID of folder in which the cube is stored

  • folder_path (str, optional) –

    Path of the folder in which the cube is stored. Can be provided as an alternative to folder_id parameter. If both are provided, folder_id 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

  • instance_id (str, optional) – Identifier of an instance if cube instance has been already initialized. Will be used if only one cube is found. None by default.

Returns:

object of type OlapCube or SuperCube based on the subtype of a cube returned from metadata.

Raises:

ValueError when neither cube_id nor cube_name are provided.

Return type:

OlapCube | SuperCube | list[OlapCube | SuperCube]