mstrio.object_management package¶
Subpackages¶
Submodules¶
mstrio.object_management.folder module¶
- class mstrio.object_management.folder.Folder(connection: Connection, id: str | None = None, path: str | None = None, name: str | None = None)¶
Bases:
Entity
,CopyMixin
,MoveMixin
,DeleteMixin
,TranslationMixin
Object representation of MicroStrategy Folder object.
- connection¶
MSTR Connection object
- id¶
ID of the folder
- name¶
name of the folder
- description¶
description of the folder
- type¶
the type of the folder (based on EnumDSSXMLObjectTypes)
- subtype¶
the subtype of the folder (based on EnumDSSXMLObjectSubTypes)
- date_created¶
the date/time at which the folder was first saved into the metadata
- date_modified¶
the date/time at which the folder was last saved into the metadata
- version¶
the version number this folder is currently carrying
- acl¶
an array of access control entry objects
- owner¶
User object, the owner of the object
- acg¶
access rights, EnumDSSXMLAccessRightFlags
- ext_type¶
object extended type, EnumDSSExtendedType
- ancestors¶
list of ancestor folders
- abbreviation¶
folder’s abbreviation
specifies whether the folder is hidden
- icon_path¶
folder icon path
- view_media¶
view media settings
- certified_info¶
CertifiedInfo object, certification status, time of certification, and information about the certifier (currently only for document and report)
- contents¶
contents of folder
- alter(name: str | None = None, description: str | None = None, hidden: bool | None = None, comments: str | None = None) None ¶
Alter the folder properties.
- Parameters:
name – folder name
description – folder description
hidden – Specifies whether the metric is hidden
comments – long description of the folder
- classmethod create(connection: Connection, name: str, parent: str | None = None, parent_path: str | None = None, description: str | None = None) Folder ¶
Create a new folder in a folder selected within connection object by providing its name, id of parent folder and optionally description.
- Parameters:
connection – MicroStrategy connection object returned by connection.Connection().
name (str) – name of a new folder.
parent (str) – id of a parent folder in which new folder will be created.
parent_path (str, optional) –
path of a parent folder in which new folder will be created. Can be provided as an alternative to parent parameter. If both are provided, parent 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
description (str, optional) – optional description of a new folder.
- Returns:
newly created folder
- get_contents(to_dictionary: bool = False, include_subfolders=False, **filters) list ¶
Get contents of a folder. It can contain other folders or different kinds of objects.
- Parameters:
to_dictionary (bool, optional) – If True returns dicts, by default (False) returns objects.
include_subfolders (bool, optional) – If True returns contents of all subfolders as well. False by default. Note that using this option may result in a large number of objects being fetched, especially if coupled with filters.
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’]
- Returns:
Contents as Python objects (when to_dictionary is False (default value)) or contents as dictionaries otherwise.
- mstrio.object_management.folder.get_folder_id_from_path(connection: Connection, path: str) str ¶
Get folder id from folder path.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
path (str) –
path of the Folder 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
- Returns:
Folder id.
- mstrio.object_management.folder.get_my_personal_objects_contents(connection: Connection, project_id: str | None = None, project_name: str | None = None, to_dictionary: bool = False) list ¶
Get contents of My Personal Objects folder in a specific project.
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 (object) – MicroStrategy connection object returned by connection.Connection()
project_id (string, optional) – project ID
project_name (string, optional) – project name
to_dictionary (bool, optional) – If True returns dicts, by default (False) returns objects.
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.folder.get_predefined_folder_contents(connection: Connection, folder_type: PredefinedFolders, project_id: str | None = None, project_name: str | None = None, to_dictionary: bool = False, limit: int | None = None, **filters) list ¶
Get contents of a pre-defined MicroStrategy folder in a specific project. Available values for folder_type are stored in enum PredefinedFolders.
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.
Note
When project_id is None, then its value is overwritten by project_id from connection object.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
folder_type (enum) – pre-defined folder type. Available values are stored in enum PredefinedFolders.
project_id (string, optional) – project ID
project_name (string, optional) – project name
to_dictionary (bool, optional) – If True returns dicts, by default (False) returns objects.
limit (int) – limit the number of elements returned. If None (default), all objects are returned.
**filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘date_created’, ‘date_modified’, ‘acg’]
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.folder.list_folders(connection: Connection, project_id: str | None = None, project_name: str | None = None, to_dictionary: bool = False, limit: int | None = None, **filters) list['Folder'] | list[dict] ¶
Get a list of folders - either all folders in a specific project or all folders that are outside of projects, called configuration-level folders. The list of configuration-level folders includes folders such as users, user groups, databases, etc. which are not project-specific. If you pass a project_id or project_name, you get folders in that project; if not, then you get configuration-level folders.
Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.
Note
Id of project is not taken directly from Connection object, so you have to specify it explicitly.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
project_id (string, optional) – project ID
project_name (string, optional) – project name
to_dictionary (bool, optional) – If True returns dicts, by default (False) returns objects.
limit (int) – limit the number of elements returned. If None (default), all objects are returned.
**filters –
- Available filter parameters: [‘name’, ‘id’, ‘type’,
- ’subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’,
’owner’, ‘hidden’,
’ext_type’]
- Returns:
list of Folder objects or list of dictionaries
mstrio.object_management.object module¶
- class mstrio.object_management.object.Object(connection: Connection, type: ObjectTypes, id: str)¶
Bases:
Entity
,ACLMixin
,CertifyMixin
,CopyMixin
,MoveMixin
,DeleteMixin
- Class representing a general type object using attributes common for
all available objects.
- name¶
name of the object
- id¶
object ID
- description¶
Description of the object
- abbreviation¶
Object abbreviation
- version¶
Object version ID
- ancestors¶
List of ancestor folders
- type¶
Object type. Enum
- subtype¶
Object subtype
- ext_type¶
Object extended type.
- date_created¶
Creation time, “yyyy-MM-dd HH:mm:ss” in UTC
- date_modified¶
Last modification time, “yyyy-MM-dd HH:mm:ss” in UTC
- owner¶
User object that is the owner
- icon_path¶
Object icon path
- view_media¶
View media settings
- acg¶
Access rights (See EnumDSSXMLAccessRightFlags for possible values)
- acl¶
Object access control list
Specifies whether the object is hidden
- certified_info¶
Certification status, time of certification, and information about the certifier (currently only for document and report)
- project_id¶
project ID
- target_info¶
target information, only applicable to Shortcut objects
- alter(name: str | None = None, description: str | None = None, abbreviation: str | None = None, hidden: bool | None = None, comments: str | None = None) None ¶
Alter the object properties.
- Parameters:
name – object name
description – object description
abbreviation – abbreviation
hidden – Specifies whether the metric is hidden
comments – long description of the object
- mstrio.object_management.object.list_objects(connection: Connection, object_type: mstrio.types.ObjectTypes | int, name: str | None = None, project_id: str | None = None, project_name: str | None = None, domain: mstrio.object_management.search_enums.SearchDomain | int = SearchDomain.CONFIGURATION, search_pattern: mstrio.object_management.search_enums.SearchPattern | int = SearchPattern.CONTAINS, to_dictionary: bool = False, limit: int = None, **filters) list['Object'] | list[dict] ¶
Get list of objects or dicts. Optionally filter the objects by specifying filters.
Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.
- Parameters:
connection – MicroStrategy connection object returned by connection.Connection()
object_type – Object type. Possible values can be found in EnumDSSXMLObjectTypes
name (string, optional) – value the search pattern is set to, which will be applied to the names of objects being searched
project_id – ID of the project for which the objects are to be listed
project_name – project name
domain – domain where the search will be performed, such as Local or Project, possible values are defined in EnumDSSXMLSearchDomain
search_pattern (SearchPattern enum or int, optional) – 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).
to_dictionary – If True returns dict, by default (False) returns Objects.
limit – limit the number of elements returned. If None (default), all objects are returned.
**filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘date_created’, ‘date_modified’, ‘acg’, ‘owner’, ‘ext_type’]
Examples
>>> list_objects(connection, object_type=ObjectTypes.USER)
mstrio.object_management.predefined_folders module¶
- class mstrio.object_management.predefined_folders.PredefinedFolders(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Enumeration constants used to specify names of pre-defined folders. Values are specified according to EnumDSSXMLFolderNames.
- AUTO_STYLES = 57¶
- BLACK_LISTED = 1000¶
- CONFIGURE_DB_ROLES = 73¶
- CONFIGURE_MONITORS = 58¶
- CONFIGURE_SERVER_DEFINITIONS = 59¶
- DBMS = 76¶
- DB_CONNECTIONS = 81¶
- DB_LOGINS = 82¶
- DEVICES = 88¶
- EVENTS = 72¶
- LINKS = 83¶
- LOCALES = 74¶
- MY_DASHBOARDS = 96¶
- MY_DOSSIERS = 96¶
- MY_SHARED_DASHBOARDS = 97¶
- MY_SHARED_DOSSIERS = 97¶
- PALETTES = 94¶
- PROFILE_ANSWERS = 21¶
- PROFILE_FAVORITES = 22¶
- PROFILE_OBJECTS = 19¶
- PROFILE_OTHER = 23¶
- PROFILE_REPORTS = 20¶
- PROFILE_SEGMENTS = 92¶
- PROJECTS = 77¶
- PROPERTY_SETS = 75¶
- PUBLIC_CONSOLIDATIONS = 2¶
- PUBLIC_CUSTOM_GROUPS = 3¶
- PUBLIC_FILTERS = 4¶
- PUBLIC_METRICS = 5¶
- PUBLIC_OBJECTS = 1¶
- PUBLIC_PROMPTS = 6¶
- PUBLIC_REPORTS = 7¶
- PUBLIC_SEARCHES = 8¶
- PUBLIC_TEMPLATES = 9¶
- ROOT = 39¶
- SCHEDULE_OBJECTS = 84¶
- SCHEDULE_TRIGGERS = 85¶
- SCHEMA_ARITHMETIC_OPERATORS = 49¶
- SCHEMA_ATTRIBUTES = 26¶
- SCHEMA_ATTRIBUTE_FORMS = 25¶
- SCHEMA_BASIC_FUNCTIONS = 41¶
- SCHEMA_COLUMNS = 27¶
- SCHEMA_COMPARISON_FOR_RANK_OPERATORS = 51¶
- SCHEMA_COMPARISON_OPERATORS = 50¶
- SCHEMA_DATA_EXPLORER = 28¶
- SCHEMA_DATE_AND_TIME_FUNCTIONS = 42¶
- SCHEMA_FACTS = 29¶
- SCHEMA_FINANCIAL_FUNCTIONS = 54¶
- SCHEMA_FUNCTIONS = 30¶
- SCHEMA_FUNCTIONS_NESTED = 40¶
- SCHEMA_HIERARCHIES = 31¶
- SCHEMA_INTERNAL_FUNCTIONS = 43¶
- SCHEMA_LOGICAL_OPERATORS = 52¶
- SCHEMA_MATH_FUNCTIONS = 55¶
- SCHEMA_NULL_ZERO_FUNCTIONS = 44¶
- SCHEMA_OBJECTS = 24¶
- SCHEMA_OLAP_FUNCTIONS = 45¶
- SCHEMA_OPERATORS = 48¶
- SCHEMA_PARTITION_FILTERS = 32¶
- SCHEMA_PARTITION_MAPPINGS = 33¶
- SCHEMA_PLUG_IN_PACKAGES = 53¶
- SCHEMA_RANK_AND_N_TILE_FUNCTIONS = 46¶
- SCHEMA_STATISTICAL_FUNCTIONS = 56¶
- SCHEMA_STRING_FUNCTIONS = 47¶
- SCHEMA_SUBTOTALS = 34¶
- SCHEMA_TABLES = 35¶
- SCHEMA_TRANSFORMATIONS = 38¶
- SCHEMA_TRANSFORMATION_ATTRIBUTES = 37¶
- SCHEMA_WAREHOUSE_TABLES = 36¶
- SECURITY_ROLES = 80¶
- SYSTEM_DIMENSION = 91¶
- SYSTEM_DRILL_MAP = 68¶
- SYSTEM_DUMMY_PARTITION_TABLES = 70¶
- SYSTEM_LINKS = 62¶
- SYSTEM_MD_SECURITY_FILTERS = 69¶
- SYSTEM_OBJECTS = 61¶
- SYSTEM_PARSER_FOLDER = 64¶
- SYSTEM_PROPERTY_SETS = 63¶
- SYSTEM_SCHEMA_FOLDER = 65¶
- SYSTEM_SYSTEM_HIERARCHY = 67¶
- SYSTEM_SYSTEM_PROMPTS = 71¶
- SYSTEM_WAREHOUSE_CATALOG = 66¶
- TABLE_SOURCES = 86¶
- TEMPLATE_ANALYSIS = 93¶
- TEMPLATE_CONSOLIDATIONS = 11¶
- TEMPLATE_CUSTOM_GROUPS = 12¶
- TEMPLATE_DASHBOARDS = 90¶
- TEMPLATE_DOCUMENTS = 60¶
- TEMPLATE_FILTERS = 13¶
- TEMPLATE_METRICS = 14¶
- TEMPLATE_OBJECTS = 10¶
- TEMPLATE_PROMPTS = 15¶
- TEMPLATE_REPORTS = 16¶
- TEMPLATE_SEARCHES = 17¶
- TEMPLATE_TEMPLATES = 18¶
- THEMES = 95¶
- TRANSMITTERS = 89¶
- USERS = 78¶
- USER_GROUPS = 79¶
- VERSION_UPDATE_HISTORY = 87¶
mstrio.object_management.search_enums module¶
- class mstrio.object_management.search_enums.CertifiedStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Enumeration that represents what can be passed in the certified_status attribute of the IServer quick search command.
- ALL = 'ALL'¶
- CERTIFIED_ONLY = 'CERTIFIED_ONLY'¶
- NOT_CERTIFIED_ONLY = 'NOT_CERTIFIED_ONLY'¶
- OFF = 'OFF'¶
- class mstrio.object_management.search_enums.SearchDomain(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
IntEnum
Enumeration constants used to specify the search domains. More details can be found in EnumDSSXMLSearchDomain in a browser.
- CONFIGURATION = 4¶
- CONFIGURATION_AND_ALL_PROJECTS = 5¶
- LOCAL = 1¶
- PROJECT = 2¶
- REPOSITORY = 3¶
- class mstrio.object_management.search_enums.SearchPattern(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
IntEnum
Enumeration constants used to specify searchType used to control BI Search. More details can be found in EnumDSSXMLSearchTypes in a browser.
- BEGIN_WITH = 1¶
- BEGIN_WITH_PHRASE = 3¶
- CONTAINS = 4¶
- CONTAINS_ANY_WORD = 0¶
- END_WITH = 5¶
- EXACTLY = 2¶
mstrio.object_management.search_operations module¶
- class mstrio.object_management.search_operations.QuickSearchData(project_id: str, object_ids: list[str])¶
Bases:
Dictable
Object that specifies a search criteria for quick search. .. attribute:: project_id
Project ID
- type:
str
- object_ids¶
List of object IDs
- Type:
list[str]
- object_ids: list[str]¶
- project_id: str¶
- class mstrio.object_management.search_operations.SearchObject(connection: Connection, id: str)¶
Bases:
Entity
,CopyMixin
,MoveMixin
,TranslationMixin
Search object describing criteria that specify a search for objects.
- connection¶
A MicroStrategy connection object
- id¶
Object ID
- name¶
Object name
- description¶
Object description
- abbreviation¶
Object abbreviation
- type¶
Object type
- subtype¶
Object subtype
- ext_type¶
Object extended type
- date_created¶
Creation time, DateTime object
- date_modified¶
Last modification time, DateTime object
- version¶
Version ID
- owner¶
Owner ID and name
- icon_path¶
Object icon path
- view_media¶
View media settings
- ancestors¶
List of ancestor folders
- acg¶
Access rights (See EnumDSSXMLAccessRightFlags for possible values)
- acl¶
Object access control list
- mstrio.object_management.search_operations.find_objects_with_id(connection: Connection, object_id: str, projects: list[mstrio.server.project.Project] | list[str] | None = None, to_dictionary=False) list[dict[str, dict | type[mstrio.utils.entity.Entity]]] ¶
Find object by its ID only, without knowing project ID and object type. The search is performed by iterating over projects and trying to retrieve the objects with different type.
- Limitation:
- Only object types supported by mstrio, i.g. present in
mstrio.types.ObjecTypes enum, are used.
Configuration object are also not searched.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection().
object_id (str) – ID of an object.
projects (list[Project] | list[str], optional) – List of projects where to perform the search. By default, if no project are provides, the search is performed on all loaded projects.
to_dictionary (bool, optional) – If True returns dicts, by default (False) returns objects.
- Returns:
- {
‘project_id’: <str>, ‘object_data’: <dict or object>
}
- Return type:
Returns list of dict with the following structure
- mstrio.object_management.search_operations.full_search(connection: Connection, project: mstrio.server.project.Project | str | None = None, name: str | None = None, pattern: mstrio.object_management.search_enums.SearchPattern | int = SearchPattern.CONTAINS, domain: mstrio.object_management.search_enums.SearchDomain | int = SearchDomain.PROJECT, root: str | None = None, root_path: str | None = None, object_types: Optional[TypeOrSubtype] = None, uses_object_id: mstrio.utils.entity.EntityBase | str | None = None, uses_object_type: mstrio.types.ObjectTypes | int | None = None, uses_recursive: bool = False, uses_one_of: bool = False, used_by_object_id: mstrio.utils.entity.EntityBase | str | None = None, used_by_object_type: mstrio.types.ObjectTypes | str | None = None, used_by_recursive: bool = False, used_by_one_of: bool = False, begin_modification_time: str | None = None, end_modification_time: str | None = None, results_format: mstrio.object_management.search_enums.SearchResultsFormat | str = SearchResultsFormat.LIST, limit: int | None = None, offset: int | None = None, to_dictionary: bool = True, **filters) list[dict] | list[mstrio.utils.entity.Entity] ¶
Perform a full metadata search and return results.
Note
If you have a large number of objects in your environment, try to use limit and offset parameters to retrieve the results in batches.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
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
objects (object_types(enum class object or integer or list of enum class) – 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_object_id (string) – Constrain the search to only return objects which use the given object.
uses_object_type (string) – Constrain the search to only return objects which use the given object. Possible values available in ENUMs mstrio.types.ObjectTypes
uses_recursive (boolean) – Control the Intelligence server to also find objects that use the given objects indirectly. Default value is false.
uses_one_of (boolean) – Control the Intelligence server to also find objects that use one of or all of given objects indirectly. Default value is false.
used_by_object_id (string) – Constrain the search to only return objects which are used by the given object.
used_by_object_type (string) – Constrain the search to only return objects which are used by the given object. Possible values available in ENUM mstrio.types.ObjectTypes
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.
used_by_one_of (boolean) – Control the Intelligence server to also find objects that are used by one of or all of given objects indirectly. Default value is false.
begin_modification_time (string, optional) – Field to filter request to return records newer than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2021-04-04T06:33:32Z.
end_modification_time (string, optional) – Field to filter request to return records older than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2022-04-04T06:33:32Z.
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’]
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.search_operations.get_search_results(connection: Connection, search_id: str, project: mstrio.server.project.Project | str | None = None, results_format: SearchResultsFormat = SearchResultsFormat.LIST, limit: int | None = None, offset: int | None = None, to_dictionary: bool = False, **filters)¶
Retrieve the results of a full metadata search previously stored in an instance in IServer memory, may be obtained by start_full_search.
Note
If you have a large number of objects in your environment, try to use limit and offset parameters to retrieve the results in batches.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
search_id (str) – Search ID (identifies the results of a previous search stored in IServer memory)
project (string) – Project object or ID
results_format (SearchResultsFormat) – either a list or a tree format
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
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’]
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.search_operations.get_search_suggestions(connection: Connection, project: mstrio.server.project.Project | str | None = None, key: str | None = None, max_results: int = 4, cross_cluster: bool | None = None) list[str] ¶
Request search suggestions from the server.
- Parameters:
connection (object) – MicroStrategy REST API connection object
project (string, optional) – Project object or ID
key (string, optional) – value the search pattern is set to, which will be applied to the names of suggestions being searched
max_results (int, optional) – maximum number of items returned for a single request. Used to control paging behavior. Default value is -1 for no limit.
cross_cluster (bool, optional) – perform search in all unique projects across the cluster, this parameter only takes effect for I-Server with cluster nodes. Default value is None
- Returns:
list of search suggestions
- mstrio.object_management.search_operations.quick_search(connection: Connection, project: mstrio.server.project.Project | str | None = None, name: str | None = None, root: str | None = None, root_path: str | None = None, pattern: mstrio.object_management.search_enums.SearchPattern | int = SearchPattern.CONTAINS, object_types: Optional[TypeOrSubtype] = None, get_ancestors: bool = False, cross_cluster: bool = False, hidden: bool | None = None, certified_status: CertifiedStatus = CertifiedStatus.ALL, limit: int | None = None, offset: int | None = None, to_dictionary: bool = True)¶
- Use the stored results of the Quick Search engine to return
search results and display them as a list. The Quick Search engine periodically indexes the metadata and stores the results in memory, making Quick Search very fast but with results that may not be the most recent.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
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).
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
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).
objects (object_types(enum class object or integer or list of enum class) – 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
get_ancestors (bool) – Specifies whether to return the list of ancestors for each object
certified_status (CertifiedStatus) – Defines a search criteria based on the certified status of the object, possible values available in CertifiedStatus enum
cross_cluster (bool) – Perform search in all unique projects across the cluster,this parameter only takes affect for I-Server with cluster nodes.
hidden (bool) – Filter the result based on the ‘hidden’ field of objects. If not passed, no filtering is applied.
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.
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.search_operations.quick_search_by_id(connection: Connection, search_data: mstrio.object_management.search_operations.QuickSearchData | list[mstrio.object_management.search_operations.QuickSearchData], to_dictionary: bool = False, **filters) list[dict | type[mstrio.utils.entity.Entity]] ¶
Perform a quick search based on a project IDs and object IDs.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
search_data (QuickSearchData | list[QuickSearchData]) – search data
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’, ‘project_id’]
- mstrio.object_management.search_operations.quick_search_from_object(connection: Connection, project: mstrio.server.project.Project | str, search_object: mstrio.object_management.search_operations.SearchObject | str, include_ancestors: bool = False, include_acl: bool = False, subtypes: mstrio.types.ObjectSubTypes | list[mstrio.types.ObjectSubTypes] | int | list[int] | None = None, limit: int | None = None, offset: int | None = None, to_dictionary: bool = True)¶
Perform a quick search based on a predefined Search Object. Use an existing search object for Quick Search engine to return search results and display them as a list.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
project (string) – Project object or ID
search_object (SearchObject) – Search object ID to retrieve result from
include_ancestors (bool) – Specifies whether to return the list of ancestors for each object
include_acl (bool) – Specifies whether to return the list of ACL for each object
subtypes (list, int) – This parameter is used to filter the objects in the result to include only the ones whose “subtype” is included in the values of this parameter
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.
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.search_operations.start_full_search(connection: Connection, project: mstrio.server.project.Project | str | None = None, name: str | None = None, object_types: Optional[TypeOrSubtype] = None, pattern: mstrio.object_management.search_enums.SearchPattern | int = SearchPattern.CONTAINS, domain: mstrio.object_management.search_enums.SearchDomain | int = SearchDomain.PROJECT, root: str | None = None, root_path: str | None = None, uses_object_id: mstrio.utils.entity.EntityBase | str | None = None, uses_object_type: mstrio.types.ObjectTypes | mstrio.types.ObjectSubTypes | int | None = None, uses_recursive: bool = False, uses_one_of: bool = False, used_by_object_id: mstrio.utils.entity.EntityBase | str | None = None, used_by_object_type: mstrio.types.ObjectTypes | mstrio.types.ObjectSubTypes | int | None = None, used_by_recursive: bool = False, used_by_one_of: bool = False, begin_modification_time: str | None = None, end_modification_time: str | None = None) dict ¶
Search the metadata for objects in a specific project that match specific search criteria, and save the results in IServer memory.
- Parameters:
connection (object) – MicroStrategy connection object returned by connection.Connection()
project (string) – Project object or ID
objects (object_types(enum class object or integer or list of enum class) – 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
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
uses_object_id (string) – Constrain the search to only return objects which use the given object.
uses_object_type (int, ObjectTypes) – Constrain the search to only return objects which use the given object. Possible values available in ENUMs mstrio.types.ObjectTypes
uses_recursive (boolean) – Control the Intelligence server to also find objects that use the given objects indirectly. Default value is false.
uses_one_of (boolean) – Control the Intelligence server to also find objects that use one of or all of given objects indirectly. Default value is false.
used_by_object_id (string) – Constrain the search to only return objects which are used by the given object.
used_by_object_type (int, ObjectTypes) – Constrain the search to only return objects which are used by the given object. Possible values available in ENUM mstrio.types.ObjectTypes
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.
used_by_one_of (boolean) – Control the Intelligence server to also find objects that are used by one or all given objects indirectly. Default value is false.
begin_modification_time (string, optional) – Field to filter request to return records newer than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2021-04-04T06:33:32Z.
end_modification_time (string, optional) – Field to filter request to return records older than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2022-04-04T06:33:32Z.
- Returns:
dictionary consisting of id (Search ID) and total items number
mstrio.object_management.shortcut module¶
- class mstrio.object_management.shortcut.Shortcut(connection: Connection, id: str, project_id: str = None, project_name: str = None, shortcut_info_flag: mstrio.object_management.shortcut.ShortcutInfoFlags | int = ShortcutInfoFlags.DssDossierShortcutInfoTOC)¶
Bases:
Entity
,CopyMixin
,MoveMixin
,TranslationMixin
- T¶
alias of TypeVar(‘T’)
- classmethod from_dict(source: dict[str, Any], connection: Connection) T ¶
Instantiate a Shortcut from a dict source.
- class mstrio.object_management.shortcut.ShortcutInfoFlags(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
IntFlag
- DssDashboardShortcutInfoBookmark = 2¶
- DssDashboardShortcutInfoDefault = 0¶
- DssDashboardShortcutInfoTOC = 1¶
- DssDossierShortcutInfoBookmark = 2¶
- DssDossierShortcutInfoDefault = 0¶
- DssDossierShortcutInfoTOC = 1¶
- mstrio.object_management.shortcut.get_shortcuts(connection: Connection, shortcut_ids: list[str], project_id: str = None, project_name: str = None, shortcut_info_flag: mstrio.object_management.shortcut.ShortcutInfoFlags | int = ShortcutInfoFlags.DssDossierShortcutInfoDefault, to_dictionary: bool = False, limit: int | None = None, **filters) list[dict] | list[mstrio.object_management.shortcut.Shortcut] ¶
- Retrieve information about specific published shortcuts
in specific project.
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.
- Args:
shortcut_ids: ids of target shortcuts project_id: id of project that the shortcuts are in project_name: Project name shortcut_info_flag: a single ShortcutInfoFlags that describes what
exact info are to be fetched
to_dictionary: parameter describing output format limit (int): limit the number of elements returned.
If None (default), all objects are returned.
- Return:
- list of dictionaries or Shortcut objects,
depending on to_dictionary parameter
mstrio.object_management.translation module¶
- class mstrio.object_management.translation.Translation(translation_target_id: str, translation_target_name: str, translation_values: list[mstrio.object_management.translation.Translation.TranslationValue])¶
Bases:
Dictable
Translation class represents a translation for an Object. It also contains methods to create, alter and delete translations for all Object types including ones not yet supported by mstrio-py
- translation_target_id¶
ID of the part of the Object the translations are for
- Type:
str
- translation_target_name¶
name of the part of the Object the translations are for
- Type:
str
- translation_values¶
list of translation values for the part of the Object
- Type:
list[Translation.TranslationValues]
- class OperationData(target_language: mstrio.server.language.Language | str | int, target_id: str, value: str | None = None)¶
Bases:
object
Object that specifies data for a single Operation on a Translation.
- target_language¶
one of the following: - lcid attribute of the language - ID of the language - Language class object
- Type:
Language | str | int
- target_id¶
ID of the specific part of the Object to be translated
- Type:
str
- value¶
value of the change, not necessary when deleting a translation
- Type:
str, optional
- class Language(connection: Connection, id: str | None = None, name: str | None = None)¶
Bases:
Entity
,DeleteMixin
,TranslationMixin
Python representation of a Microstrategy Language object.
- id¶
language’s ID
- Type:
str
- name¶
language’s name
- Type:
str
- base_language_lcid¶
LC ID of the language serving as a base for the language
- Type:
int
- lcid¶
LC ID of the language
- Type:
int
- last_modified¶
date of when language was last modified
- Type:
datetime
- formatting_settings¶
formatting settings of the language
- Type:
- interface_language¶
details of the language’s interface language
- Type:
whether the language is hidden
- Type:
bool
- is_language_supported¶
whether the language is supported
- Type:
bool
- class InterfaceLanguage(name: str, id: str, sub_type: mstrio.types.ObjectSubTypes | None = None)¶
Bases:
Dictable
Object that stores the interface language of the Language.
- name¶
name of the interface language
- Type:
str
- id¶
id of the interface language
- Type:
str
- sub_type¶
subtype of the interface language, defaults to None
- Type:
- id: str¶
- name: str¶
- sub_type: ObjectSubTypes | None = None¶
- class TimeInterval(minutes15: str, minutes30: str, hour: str, day: str, week: str, hour_of_day: str, month: str, quarter: str, year: str)¶
Bases:
Dictable
Object that stores formatting settings of the Language.
- minutes15¶
formatting settings for 15 minutes
- Type:
str
- minutes30¶
formatting settings for 30 minutes
- Type:
str
- hour¶
formatting settings for an hour
- Type:
str
- day¶
formatting settings for a day
- Type:
str
- week¶
formatting settings for a week
- Type:
str
- hour_of_day¶
formatting settings for the hour of the day
- Type:
str
- month¶
formatting settings for a month
- Type:
str
- quarter¶
formatting settings for a quarter
- Type:
str
- year¶
formatting settings for a year
- Type:
str
- Formatting settings instructions:
- To specify formatting for:
hours: use the letter h minutes: use the letter m days: use the letter d months: use the capital letter M quarters: use the letter q years: use the letter y
To specify 12 hour clock use AM/PM afterwards, example: h:mm AM/PM
- Default formatting settings examples:
minutes15: h:mm AM/PM -> 9:44 AM minutes30: h:mm AM/PM -> 9:44 AM hour: h:mm AM/PM -> 9:44 AM day: M/d -> 7/26 week: M/d -> 7/26 hour_of_day: h:mm AM/PM -> 9:44 AM month: MMM -> Jul quarter: qqq -> Q3 year: yyyy -> 2023
- day: str¶
- hour: str¶
- hour_of_day: str¶
- minutes15: str¶
- minutes30: str¶
- month: str¶
- quarter: str¶
- week: str¶
- year: str¶
- alter(name: str | None = None, formatting_settings: TimeInterval | None = None) None ¶
Alter the language’s specified properties.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
name (str, Optional) – new name for the Language
formatting_settings (TimeInverval, Optional) – new formatting settings for the Language
- classmethod create(connection: Connection, name: str, base_language: Language | str | int, interface_language_id: str | None = None, formatting_settings: TimeInterval | None = None) Language ¶
Create a new language with specified properties.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
name (str) – the name for the new Language
base_language (Language | str | int) –
one of the following: - lcid attribute of the language that will be used as a base
language for the new Language
- ID of the language that will be used as a base language for
the new Language
- Language class object that will be used as a base language for
the new Language
interface_language_id (str, Optional) – id of the new Language’s interface language
formatting_settings (TimeInterval, Optional) – formatting settings for the new Language
- Returns:
Language class object.
- target_id: str¶
- target_language: mstrio.server.language.Language | str | int¶
- value: str | None = None¶
- class TranslationValue(value: str, language_lcid: str)¶
Bases:
Dictable
Object that specifies a Translation for a single Language
- value¶
value of the translation
- Type:
str
- language_lcid¶
LCID of the language
- Type:
str
- language_lcid: str¶
- value: str¶
- static add_translation(connection: Connection, id: str, object_type: int | mstrio.types.ObjectTypes, translations: list[mstrio.object_management.translation.Translation.OperationData], project_id: str | None = None) list[mstrio.object_management.translation.Translation] ¶
Adds translations to the Object.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by
connection.Connection() –
id (str) – ID of the Object the translation will be added to
object_type (int | ObjectTypes) – type of the Object
translations (list[OperationData]) – list of translations to be added to the Object
project_id (str, optional) – project ID of the project the Object is located in, if not specified will be taken from the Connection
- Returns:
A list of translations for the Object.
- static add_translations_from_csv(connection: Connection, file_path: str, separator: str = ';', project_id: str | None = None, delete: bool = False, automatch_target_ids: bool = False) None ¶
Add translations from a specified CSV file.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
file_path (str) – a path specifying the CSV file
separator (str, optional) – specify the separator of the csv file. Defaults to a semicolon ;
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
delete (bool, optional) – if True deletes translations for languages that are empty in the CSV file. False by default.
automatch_target_ids (bool, optional) – if True tries to match the target IDs from the file that are not found in the Objects on the server by the content of the translation for the project’s default language. False by default.
To ensure correct import, the columns from the original file cannot be renamed. Columns can be deleted (with the exception of object ID, object type and target ID) but new columns cannot be added. The column order does not matter.
- static add_translations_from_database(connection: Connection, table_name: str, datasource: mstrio.datasources.datasource_instance.DatasourceInstance | str, project_id: str | None = None, delete: bool = False, automatch_target_ids: bool = False) None ¶
Add translations from a specified database table.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
table_name (str) – name of the table to import the data from
datasource (DatasourceInstance | str) – DatasourceInstance object or ID of the DatasourceInstance containing the connection to the database to export the data to
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
delete (bool, optional) – if True deletes translations for languages that are empty in the database table. False by default.
automatch_target_ids (bool, optional) – if True tries to match the target IDs from the file that are not found in the Objects on the server by the content of the translation for the project’s default language. False by default.
To ensure correct import, the columns originally exported to database cannot be renamed. Columns can be deleted (with the exception of object ID, object type and target ID) but new columns cannot be added.
- static add_translations_from_dataframe(connection: Connection, dataframe: DataFrame, project_id: str | None = None, delete: bool = False, automatch_target_ids: bool = False) None ¶
Add translations from a given dataframe.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
dataframe (pd.DataFrame) – dataframe containing the data to be imported
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
delete (bool, optional) – if True deletes translations for languages that are empty in the dataframe. False by default.
automatch_target_ids (bool, optional) – if True tries to match the target IDs from the file that are not found in the Objects on the server by the content of the translation for the project’s default language. False by default.
To ensure correct import, the columns from the original dataframe cannot be renamed. Columns can be deleted (with the exception of object ID, object type and target ID) but new columns cannot be added. The column order does not matter.
- static add_translations_from_json(connection: Connection, file_path: str, project_id: str | None = None, delete: bool = False, automatch_target_ids: bool = False) None ¶
Add translations from a specified JSON file.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
file_path (str) – a path specifying the JSON file
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
delete (bool, optional) – if True deletes translations for languages that are empty in the JSON file. False by default.
automatch_target_ids (bool, optional) – if True tries to match the target IDs from the file that are not found in the Objects on the server by the content of the translation for the project’s default language. False by default.
To ensure correct import, the columns from the original file cannot be renamed. Columns can be deleted (with the exception of object ID, object type and target ID) but new columns cannot be added. The column order does not matter.
- static alter_translation(connection: Connection, id: str, object_type: int | mstrio.types.ObjectTypes, translations: list[mstrio.object_management.translation.Translation.OperationData], project_id: str | None = None) None ¶
Alters translations for the Object.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by
connection.Connection() –
id (str) – ID of the Object the translation will be added to
object_type (int | ObjectTypes) – type of the Object
translations (list[OperationData]) – list of translations to be added to the Object
project_id (str, optional) – project ID of the project the Object is located in, if not specified will be taken from the Connection
- static remove_translation(connection: Connection, id: str, object_type: int | mstrio.types.ObjectTypes, translations: list[mstrio.object_management.translation.Translation.OperationData], project_id: str | None = None) None ¶
Removes translations from the Object.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by
connection.Connection() –
id (str) – ID of the Object the translation will be added to
object_type (int | ObjectTypes) – type of the Object
translations (list[OperationData]) – list of translations to be added to the Object
project_id (str, optional) – project ID of the project the Object is located in, if not specified will be taken from the Connection
- static to_csv_from_list(connection: Connection, object_list: list[mstrio.utils.entity.Entity], separator: str = ';', languages: list | None = None, file_path: str | None = None, project_id: str | None = None, denormalized_form: bool = False, add_object_path: bool = False, add_object_description: bool = False, add_object_version: bool = False, add_object_last_modified_date: bool = False, add_object_creation_date: bool = False) str | None ¶
Export translations of the given objects to a CSV file.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
object_list (list[Entity]) – list of Objects to export translations for. Objects have to be provided as class objects such as a Metric or a Document.
separator (str, optional) – specify the separator for the csv file. Defaults to a semicolon ;
languages (list, optional) –
list of languages to list translations for, only translations from these languages will be listed. If not specified languages will be taken from the project. Languages in the list should be one of the following:
ID of the language
Language class object
file_path (str, optional) – a path specifying where to save the csv file
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
denormalized_form (bool, optional) – if True exports the data in a denormalized form, if False exports the data in a normalized form. False by default. Normalised form means that each row contains a single target_id with translation values for all required languages Denormalised form means each row represents a translation value for one target_id and one language at a time
add_object_path (bool, optional) – if True adds a column with the path of the Object
add_object_description (bool, optional) – if True adds a column with the description of the Object
add_object_version (bool, optional) – if True adds a column with the version of the Object
add_object_last_modified_date (bool, optional) – if True adds a column with the last modified date of the Object
add_object_creation_date (bool, optional) – if True adds a column with the creation date of the Object
- Returns:
String representation of the CSV file if no path was given or None if path was provided.
- static to_database_from_list(connection: Connection, object_list: list[mstrio.utils.entity.Entity], table_name: str, datasource: mstrio.datasources.datasource_instance.DatasourceInstance | str, database_type: str | None = None, languages: list | None = None, project_id: str | None = None, denormalized_form: bool = False, add_object_path: bool = False, add_object_description: bool = False, add_object_version: bool = False, add_object_last_modified_date: bool = False, add_object_creation_date: bool = False, force: bool = False) None ¶
Export translations of the given objects to an SQL database table.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
object_list (list[Entity]) – list of Objects to export translations for. Objects have to be provided as class objects such as a Metric or a Document.
table_name (str) – name of the table to export the data to If the table with the given name already exists, the existing table will be dropped first, then a new one will be created.
datasource (DatasourceInstance | str) – DatasourceInstance object or ID of the DatasourceInstance containing the connection to the database to export the data to
database_type (str, optional) –
type of the database, if not provided standard SQL will be used. Supported database types include:
MySQL
MSSQL
PostgreSQL
Oracle
Vertica
languages (list, optional) –
list of languages to list translations for, only translations from these languages will be listed. If not specified languages will be taken from the project. Languages in the list should be one of the following:
ID of the language
Language class object
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
denormalized_form (bool, optional) – if True exports the data in a denormalized form, if False exports the data in a normalized form. False by default. Normalised form means that each row contains a single target_id with translation values for all required languages Denormalised form means each row represents a translation value for one target_id and one language at a time
add_object_path (bool, optional) – if True adds a column with the path of the Object
add_object_description (bool, optional) – if True adds a column with the description of the Object
add_object_version (bool, optional) – if True adds a column with the version of the Object
add_object_last_modified_date (bool, optional) – if True adds a column with the last modified date of the Object
add_object_creation_date (bool, optional) – if True adds a column with the creation date of the Object
force (bool, optional) – if True skips the prompt asking for confirmation before dropping the table. False by default.
- static to_dataframe_from_list(connection: Connection, object_list: list[mstrio.utils.entity.Entity], languages: list | None = None, project_id: str | None = None, denormalized_form: bool = False, add_object_path: bool = False, add_object_description: bool = False, add_object_version: bool = False, add_object_last_modified_date: bool = False, add_object_creation_date: bool = False) DataFrame ¶
Export translations of the given objects to a dataframe.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
object_list (list[Entity]) – list of Objects to export translations for. Objects have to be provided as class objects such as a Metric or a Document.
languages (list, optional) –
list of languages to list translations for, only translations from these languages will be listed. If not specified languages will be taken from the project. Languages in the list should be one of the following:
ID of the language
Language class object
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
denormalized_form (bool, optional) – if True exports the data in a denormalized form, if False exports the data in a normalized form. False by default. Normalised form means that each row contains a single target_id with translation values for all required languages Denormalised form means each row represents a translation value for one target_id and one language at a time
add_object_path (bool, optional) – if True adds a column with the path of the Object
add_object_description (bool, optional) – if True adds a column with the description of the Object
add_object_version (bool, optional) – if True adds a column with the version of the Object
add_object_last_modified_date (bool, optional) – if True adds a column with the last modified date of the Object
add_object_creation_date (bool, optional) – if True adds a column with the creation date of the Object
- Returns:
A pandas Dataframe containing the translation data.
- static to_json_from_list(connection: Connection, object_list: list[mstrio.utils.entity.Entity], languages: list | None = None, file_path: str | None = None, project_id: str | None = None, denormalized_form: bool = False, add_object_path: bool = False, add_object_description: bool = False, add_object_version: bool = False, add_object_last_modified_date: bool = False, add_object_creation_date: bool = False) str | None ¶
Export translations of the given objects to a JSON file.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
object_list (list[Entity]) – list of Objects to export translations for. Objects have to be provided as class objects such as a Metric or a Document.
languages (list, optional) –
list of languages to list translations for, only translations from these languages will be listed. If not specified languages will be taken from the project. Languages in the list should be one of the following:
ID of the language
Language class object
file_path (str, optional) – a path specifying where to save the json file
project_id (str, optional) – ID of the project the Objects are a part of, if not provided will be taken from connection
denormalized_form (bool, optional) – if True exports the data in a denormalized form, if False exports the data in a normalized form. False by default. Normalised form means that each row contains a single target_id with translation values for all required languages Denormalised form means each row represents a translation value for one target_id and one language at a time
add_object_path (bool, optional) – if True adds a column with the path of the Object
add_object_description (bool, optional) – if True adds a column with the description of the Object
add_object_version (bool, optional) – if True adds a column with the version of the Object
add_object_last_modified_date (bool, optional) – if True adds a column with the last modified date of the Object
add_object_creation_date (bool, optional) – if True adds a column with the creation date of the Object
- Returns:
String representation of the JSON file if no path was given or None if path was provided.
- translation_target_id: str¶
- translation_target_name: str¶
- translation_values: list[mstrio.object_management.translation.Translation.TranslationValue]¶
- mstrio.object_management.translation.list_translations(connection: Connection, id: str, object_type: int | mstrio.types.ObjectTypes, project_id: str | None = None, languages: list | None = None, to_dictionary: bool = False) list[mstrio.object_management.translation.Translation] | list[dict] ¶
Lists translations of the given Object.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
id (str) – ID of the Object the translations will be listed for
object_type (int | ObjectTypes) – type of the Object the translations will be listed for
project_id (str, optional) – project ID of the project the Object is on, if not provided will be taken from connection
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 a list of dictionaries, by default (False) returns a list of Translation objects
- Returns:
A list of dictionaries representing translations for the Object or a list of Translation Objects.