mstrio > server > project

class mstrio.server.project.DuplicationConfig(schema_objects_only=True, skip_empty_profile_folders=True, include_user_subscriptions=True, include_contact_subscriptions=True, import_description='Project Duplication', import_default_locale=0, import_locales=<factory>)

Bases: Dictable

Configuration for project duplication.

Parameters:
  • schema_objects_only (bool) –

  • skip_empty_profile_folders (bool) –

  • include_user_subscriptions (bool) –

  • include_contact_subscriptions (bool) –

  • import_description (str | None) –

  • import_default_locale (int | None) –

  • import_locales (list[int] | None) –

schema_objects_only

If True, only schema objects will be duplicated.

Type:

bool, optional

skip_empty_profile_folders

Whether to skip empty profile folders during duplication.

Type:

bool, optional

include_user_subscriptions

Whether to include user subscriptions in the duplication.

Type:

bool, optional

include_contact_subscriptions

Whether to include contact subscriptions in the duplication.

Type:

bool, optional

import_description

Description for the import operation to be stored in ProjectDuplication class object.

Type:

str, optional

import_default_locale

Locale used for internationalization in imported project. Please provide Language object ‘lcid’ attribute.

Type:

int, optional

import_locales

List of locale ids for imported project. Please provide Language object ‘lcid’ attribute.

Type:

list[int], optional

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

classmethod from_dict(source, **kwargs)

Initialize DuplicationConfig object from raw settings dictionary.

to_dict()

Convert the duplication configuration to a dictionary accepted by the API.

Return type:

dict

import_default_locale: int | None = 0
import_description: str | None = 'Project Duplication'
import_locales: list[int] | None
include_contact_subscriptions: bool = True
include_user_subscriptions: bool = True
schema_objects_only: bool = True
skip_empty_profile_folders: bool = True
enum mstrio.server.project.IdleMode(value)

Bases: AutoName

Used to specify the exact behaviour of idle request.

REQUEST (Request Idle): all executing and queued jobs finish executing

and any newly submitted jobs are rejected.

EXECUTION (Execution Idle for All Jobs): all executing, queued, and

newly submitted jobs are placed in the queue, to be executed when the project resumes.

WAREHOUSEEXEC (Execution Idle for Warehouse jobs): all executing,

queued, and newly submitted jobs that require SQL to be submitted to the data warehouse are placed in the queue, to be executed when the project resumes. Any jobs that do not require SQL to be executed against the data warehouse are executed.

FULL (Request Idle and Execution Idle for All jobs): all executing and

queued jobs are canceled, and any newly submitted jobs are rejected.

PARTIAL (Request Idle and Execution Idle for Warehouse jobs): all

executing and queued jobs that do not submit SQL against the data warehouse are canceled, and any newly submitted jobs are rejected. Any currently executing and queued jobs that do not require SQL to be executed against the data warehouse are executed.

Valid values are as follows:

REQUEST = IdleMode.REQUEST
EXECUTION = IdleMode.EXECUTION
WAREHOUSEEXEC = IdleMode.WAREHOUSEEXEC
FULL = IdleMode.FULL
PARTIAL = IdleMode.PARTIAL
UNLOADED = IdleMode.UNLOADED
LOADED = IdleMode.LOADED
UNLOADED_PENDING = IdleMode.UNLOADED_PENDING
LOADED_PENDING = IdleMode.LOADED_PENDING
PENDING = IdleMode.PENDING
UNKNOWN = IdleMode.UNKNOWN
enum mstrio.server.project.LockType(value)

Bases: AutoName

Enum representing the type of lock applied to a project.

TEMPORAL_INDIVIDUAL: A temporary lock that restricts all other sessions

except the current user’s session from editing the project. This lock disappears when the user’s session expires.

TEMPORAL_CONSTITUENT: A temporary lock that restricts all other sessions

except the current user’s session from editing the project and all objects in the project. This lock disappears when the user’s session expires.

PERMANENT_INDIVIDUAL: A permanent lock that prevents all users from

editing the project. This lock does not expire and must be removed before the project can be edited again.

PERMANENT_CONSTITUENT: A permanent lock that prevents all users from

editing the project and all objects in the project. This lock does not expire and must be removed before the project and its objects can be edited again.

NOT_LOCKED: Represents the state where the project is not locked

and can be edited by users.

Valid values are as follows:

TEMPORAL_INDIVIDUAL = LockType.TEMPORAL_INDIVIDUAL
TEMPORAL_CONSTITUENT = LockType.TEMPORAL_CONSTITUENT
PERMANENT_INDIVIDUAL = LockType.PERMANENT_INDIVIDUAL
PERMANENT_CONSTITUENT = LockType.PERMANENT_CONSTITUENT
NOT_LOCKED = LockType.NOT_LOCKED
class mstrio.server.project.Project(connection, name=None, id=None)

Bases: Entity, ModelVldbMixin, DeleteMixin

Object representation of Strategy One Project (Project) object.

Parameters:
  • connection (Connection) –

  • name (str | None) –

  • id (str | None) –

connection

A Strategy One connection object

settings

Project settings object

id

Project ID

name

Project name

description

Project description

alias

Project alias

type

Object type

subtype

Object subtype

ext_type

Object extended type

nodes

List of nodes on which project is loaded

date_created

Creation time, “yyyy-MM-dd HH:mm:ss” in UTC

date_modified

Last modification time, “yyyy-MM-dd

version

Version ID

owner

owner ID and name

acg

Access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

Object access control list

status

Project

ancestors

List of ancestor folders

data_language_settings

Project data language settings

metadata_language_settings

Project metadata language settings

class LockStatus(lock_type, lock_time=None, comment=None, machine_name=None, owner=None)

Bases: Dictable

Object representation of Project Lock Status.

Parameters:
  • lock_type (LockType) –

  • lock_time (datetime | None) –

  • comment (str | None) –

  • machine_name (str | None) –

  • owner (User | None) –

lock_type

Lock type

Type:

LockType

lock_time

Lock time

Type:

datetime.datetime | None

comment

Lock comment

Type:

str | None

machine_name

Machine name

Type:

str | None

owner

User object

Type:

User | None

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

classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)

Creates an object from a dictionary. The dictionary’s 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 _FROM_DICT_MAP.

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, 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:

An object of type T.

Return type:

T

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

comment: str | None = None
lock_time: datetime | None = None
lock_type: LockType
machine_name: str | None = None
owner: User | None = None
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_datasource(datasources)

Add datasources to the project.

Parameters:

datasources (list["DatasourceInstance", str]) – List of datasource objects or datasource IDs to be added to the project.

Returns:

List of datasource objects for the project.

Return type:

list[’DatasourceInstance’]

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, comments=None, owner=None, alias=None)

Alter project name or/and description.

Parameters:
  • name (str, optional) – new name of the project.

  • description (str, optional) – new description of the project.

  • comments (str, optional) – long description of the project.

  • owner (str | User | None) – (str, User, optional): owner of the project.

  • alias (str, optional) – new alias of the project.

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

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

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()

Delete project.

Returns:

True if project was deleted, False otherwise.

Parameters:

self (Entity) –

Return type:

bool

delete_element_cache()

Delete element cache for the current project on the I-Server.

Return type:

None

delete_object_cache()

Delete object cache for the current project on the I-Server.

Return type:

None

disable_caching()

Disable caching settings for the current project on the I-Server.

Return type:

None

duplicate(target_name, duplication_config=None)

Duplicate the project with a new name.

Parameters:
  • target_name (str) – New name for the duplicated project.

  • duplication_config (dict, DuplicationConfig, optional) – Configuration for the duplication process. If not provided DuplicationConfig() with default values will be used.

Returns:

ProjectDuplication object.

Return type:

ProjectDuplication

enable_caching()

Enable caching settings for the current project on the I-Server.

Return type:

None

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_settings()

Fetch the current project settings from the I-Server.

Return type:

None

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_current_engine_version()
get_data_engine_versions()

Fetch the currently available data engine versions for project.

Return type:

dict

get_status_on_node(node)

Get status of the project of specific node in the connected Intelligence server cluster.

Parameters:

node (str, Node) – Name of the node or Node object.

Returns:

Status of the project on the node.

Return type:

IdleMode

idle(on_nodes=None, mode=IdleMode.REQUEST)

Request to idle a specific cluster node. Idle project with mode options.

Parameters:
  • on_nodes (str | list[str] | None) – Name of node, if not passed, project will be idled on all of the nodes.

  • mode (IdleMode | str) – One of: IdleMode values.

Return type:

None

is_loaded()

Check if the project is loaded on any node (server).

Return type:

bool

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_caching_settings()

Fetch current project settings connected with caching from I-Server

Return type:

dict

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(excluded_properties=None)

Fetches all attributes from the server and converts all properties of the object to a dictionary.

Parameters:

excluded_properties (list[str], optional) – A list of object properties that should be excluded from the dict. Defaults to None.

Returns:

A dictionary which keys are object’s attribute names, and

which values are object’s attribute values.

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

load(on_nodes=None)

Request to load the project onto the chosen cluster nodes. If nodes are not specified, the project will be loaded on all nodes.

Parameters:

on_nodes (str | list[str] | Node | list[Node] | None) – Name of node, if not passed, project will be loaded on all of the nodes.

Return type:

None

lock(lock_type, lock_id=None)

Lock the project.

Parameters:
  • lock_type (str, LockType) – Lock type.

  • lock_id (str, optional) – Lock ID.

Return type:

None

print()

Pretty Print all properties of the object.

Return type:

None

register(on_nodes=None)

Register project on nodes.

A registered project will load on node (server) startup.

Parameters:

on_nodes (str | list | None) – Name of node, if not passed, project will be loaded on all available nodes on startup.

Return type:

None

remove_datasource(datasources)

Remove datasources from the project.

Parameters:

datasources (list["DatasourceInstance", str]) – List of datasource objects or datasource IDs to be removed from the project.

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

resume(on_nodes=None)

Request to resume the project on the chosen cluster nodes. If nodes are not specified, the project will be loaded on all nodes.

Parameters:

on_nodes (str | list[str] | None) – Name of node, if not passed, project will be resumed on all of the nodes.

Return type:

None

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()

Converts all properties of the object to a dataframe.

Returns:

A DataFrame object containing object properties.

Return type:

DataFrame

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

unload(on_nodes=None)

Request to unload the project from the chosen cluster nodes. If nodes are not specified, the project will be unloaded on all nodes. The unload action cannot be performed until all jobs and connections for project are completed. Once these processes have finished, pending project will be automatically unloaded.

Parameters:

on_nodes (str | list[str] | Node | list[Node] | None) – Name of node, if not passed, project will be unloaded on all of the nodes.

Return type:

None

unlock(lock_type=None, lock_id=None, force=False)

Unlock the project.

Parameters:
  • lock_type (str, LockType, optional) – Lock type. Optional only if force is set to True.

  • lock_id (str, optional) – Lock ID.

  • force (bool, optional) – Whether to force unlock the project.

Return type:

None

unregister(on_nodes=None)

Unregister project on nodes.

An unregistered project will not load on node (server) startup.

Parameters:

on_nodes (str or list, optional) – Name of node, if not passed, project will not be loaded on any nodes on startup.

Return type:

None

update_data_engine_version(new_version)

Update data engine version for project.

Parameters:

new_version (str) –

Return type:

None

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

update_settings()

Update the current project settings on the I-Server.

Return type:

None

class mstrio.server.project.ProjectDuplication(connection, id)

Bases: EntityBase

Object representation of a project duplication request.

Parameters:
id

Duplication job ID.

Type:

str

source

Source environment, project, and creator info.

Type:

ProjectInfo

target

Target environment, project, and creator info.

Type:

ProjectInfo

created_date

Duplication creation date.

Type:

datetime

last_updated_date

Duplication last update date.

Type:

datetime

status

Duplication status.

Type:

ProjectDuplicationStatus

progress

Duplication progress percentage.

Type:

int

message

Status or error message.

Type:

str

settings

Duplication settings.

Type:

DuplicationConfig

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

cancel()

Cancel the project duplication job.

Returns:

True if the cancellation was successful, False otherwise.

Return type:

bool

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

classmethod from_dict(source, connection=None, 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

list_properties(excluded_properties=None)

Fetches all attributes from the server and converts all properties of the object to a dictionary.

Parameters:

excluded_properties (list[str], optional) – A list of object properties that should be excluded from the dict. Defaults to None.

Returns:

A dictionary which keys are object’s attribute names, and

which values are object’s attribute values.

Return type:

dict

print()

Pretty Print all properties of the object.

Return type:

None

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()

Converts all properties of the object to a dataframe.

Returns:

A DataFrame object containing object properties.

Return type:

DataFrame

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

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

wait_for_stable_status(timeout=240, interval=2)

Wait for the project duplication to reach a stable status.

Parameters:
  • timeout (int, optional) – Maximum time to wait in seconds.

  • interval (int, optional) – Time between status checks in seconds.

Returns:

The project duplication object with updated

status.

Return type:

ProjectDuplication

enum mstrio.server.project.ProjectDuplicationStatus(value)

Bases: AutoUpperName

Enum representing the status of a project duplication.

Valid values are as follows:

UNKNOWN = <ProjectDuplicationStatus.UNKNOWN: 'UNKNOWN'>
CREATED = <ProjectDuplicationStatus.CREATED: 'CREATED'>
CREATE_FAILED = <ProjectDuplicationStatus.CREATE_FAILED: 'CREATE_FAILED'>
EXPORTING = <ProjectDuplicationStatus.EXPORTING: 'EXPORTING'>
EXPORTED = <ProjectDuplicationStatus.EXPORTED: 'EXPORTED'>
EXPORT_FAILED = <ProjectDuplicationStatus.EXPORT_FAILED: 'EXPORT_FAILED'>
IMPORTING = <ProjectDuplicationStatus.IMPORTING: 'IMPORTING'>
IMPORT_FAILED = <ProjectDuplicationStatus.IMPORT_FAILED: 'IMPORT_FAILED'>
COMPLETED = <ProjectDuplicationStatus.COMPLETED: 'COMPLETED'>
CANCELLED = <ProjectDuplicationStatus.CANCELLED: 'CANCELLED'>
CANCELLING = <ProjectDuplicationStatus.CANCELLING: 'CANCELLING'>
EXPORT_SYNCING = <ProjectDuplicationStatus.EXPORT_SYNCING: 'EXPORT_SYNCING'>
IMPORT_SYNCING = <ProjectDuplicationStatus.IMPORT_SYNCING: 'IMPORT_SYNCING'>
class mstrio.server.project.ProjectInfo(creator=<factory>, environment=<factory>, project=<factory>)

Bases: Dictable

Dataclass to store project duplication record info. It stores environment, project, and creator info.

Parameters:
  • creator (dict) –

  • environment (dict) –

  • project (dict) –

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

classmethod from_dict(source, **kwargs)

Initialize ProjectInfo from a dictionary.

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

creator: dict
environment: dict
project: dict
class mstrio.server.project.ProjectSettings(connection, project_id=None)

Bases: BaseSettings

Object representation of Strategy One Project (Project) Settings.

Used to fetch, view, modify, update, export to file, import from file and validate Project settings.

The object can be optionally initialized with connection and project_id, which will automatically fetch the current settings for the specified project. If not specified, settings can be loaded from file using import_from() method. Object attributes (representing settings) can be modified manually. Lastly, the object can be applied to any project using the update() method.

Parameters:
  • connection (Connection) –

  • project_id (str | None) –

connection

A Strategy One connection object

alter(**settings)

Alter settings in a command manager like way.

compare_with_files(files, show_diff_only=False)

Compare the current project settings to settings in file/files :param files: List of paths to the settings files. Supported settings

files are JSON, CSV, Pickle. Ex: “/file.csv”

Parameters:
  • show_diff_only (bool, optional) – Whether to display all settings or only different from first project in list.

  • files (str) –

Returns:

Dataframe with values of current settings and settings from files.

Return type:

DataFrame

disable_caching()

—————— WORK IN PROGRESS ——————

This functionality is a work-in-progress. Use it only if you understand the underlying code. It may change in future updates.


Disable caching settings for the current project on I-Server using this Settings object

Return type:

None

enable_caching()

—————— WORK IN PROGRESS ——————

This functionality is a work-in-progress. Use it only if you understand the underlying code. It may change in future updates.


Enable caching settings for the current project on I-Server using this Settings object

Return type:

None

fetch(project_id=None)

Fetch current project settings from I-Server and update this ProjectSettings object.

Parameters:

project_id (str | None) – Project ID

Return type:

None

import_from(file)

Import project settings from a ‘csv’, ‘json’ or ‘pickle’ file.

Parameters:

file (str) – Path to the file with supported extension type name. Ex: “<path>/file.csv”

Return type:

None

list_caching_properties(show_description=False)

—————— WORK IN PROGRESS ——————

This functionality is a work-in-progress. Use it only if you understand the underlying code. It may change in future updates.


Fetch current project settings connected with caching from I-Server

Parameters:

show_description (bool) – if True return, description and value for each setting, else, return values only

Return type:

dict

list_properties(show_names=True, show_description=False)

Return settings and their values as dictionary.

Parameters:
  • show_names (bool) – if True, return meaningful setting values, else, return exact setting values

  • show_description (bool) – if True return, description and value for each setting, else, return values only

Return type:

dict

to_csv(name, show_description=False)

Export the current project settings to the csv file.

Parameters:
  • name (str) – Name of file

  • show_description (bool) – if True return, description and value for each setting, else, return values only

Return type:

None

to_dataframe()

Return a DataFrame object containing settings and their values.

Return type:

DataFrame

to_json(name)

Export the current project settings to the json file :param name: Name of file :type name: str

Parameters:

name (str) –

Return type:

None

to_pickle(name)

Export the current project settings to the pickle file :param name: Name of file :type name: str

Parameters:

name (str) –

Return type:

None

update(project_id=None)

Update the current project settings on I-Server using this Settings object.

Parameters:

project_id (str | None) – Project ID

Return type:

None

enum mstrio.server.project.ProjectStatus(value)

Bases: IntEnum

Member Type:

int

Valid values are as follows:

ACTIVE = <ProjectStatus.ACTIVE: 0>
ERRORSTATE = <ProjectStatus.ERRORSTATE: -3>
EXECIDLE = <ProjectStatus.EXECIDLE: 1>
FULLIDLE = <ProjectStatus.FULLIDLE: 7>
OFFLINE = <ProjectStatus.OFFLINE: -1>
OFFLINEPENDING = <ProjectStatus.OFFLINEPENDING: -2>
ONLINEPENDING = <ProjectStatus.ONLINEPENDING: -4>
REQUESTIDLE = <ProjectStatus.REQUESTIDLE: 2>
WHEXECIDLE = <ProjectStatus.WHEXECIDLE: 4>

The Enum and its members also have the following methods:

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
conjugate()

Returns self, the complex conjugate of any int.

from_bytes(byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

mstrio.server.project.compare_project_settings(projects, show_diff_only=False)

Compares settings of project objects.

Parameters:
  • projects (List[Project]) – List of project objects to compare.

  • show_diff_only (bool, optional) – Whether to display all settings or only different from first project in list.

Return type:

DataFrame

mstrio.server.project.list_projects(conn=None, env=None, *args, **kwargs)

Return list of project objects or project dicts if to_dictionary=True. Optionally filter the Projects by specifying the filters keyword arguments.

This is a helper method using Environment.list_projects() under the hood. See Environment.list_projects() documentation for more details.

Either conn or env must be provided.

Parameters:
mstrio.server.project.conn

A Strategy One connection object.

Type:

Connection, optional

mstrio.server.project.env

Environment object instance.

Type:

Environment, optional

...

Additional parameters to pass to Environment.list_projects().

Type:

optional

mstrio.server.project.list_projects_duplications(connection, limit=None, to_dictionary=False)

Get project duplications.

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

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

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

Returns:

List of ProjectDuplication objects or list od dicts.

Return type:

list[ProjectDuplication | dict]