mstrio.project_objects package¶
Subpackages¶
Submodules¶
mstrio.project_objects.content_cache module¶
- class mstrio.project_objects.content_cache.ContentCache(connection: Connection, id: str, content_cache_dict: Optional[dict] = None)¶
Bases:
Cache
,ContentCacheMixin
Manage content cache.
_CACHE_TYPE is a variable used by ContentCache class for cache filtering purposes.
- delete(force: Optional[bool] = None) Response ¶
Delete content cache.
- Parameters:
force (bool, optional) – If True, then no additional prompt will be shown before deleting object.
- Returns:
Response object.
- fetch()¶
Fetches the cache from the server, refreshing the variables to match those currently stored on the server.
- classmethod from_dict(connection: Connection, caches: list[dict]) list[mstrio.project_objects.content_cache.ContentCache] ¶
Creates Caches from a provided dictionary.
- Parameters:
cls (object) – Class type for objects to be created
connection (Connection) – MicroStrategy connection object returned by connection.Connection()
caches (list[dict]) – list of dictionaries the Caches will be created from
- Returns:
List of Caches created from the provided dictionaries.
- list_properties()¶
List properties for content cache.
- load()¶
Load content cache.
- unload()¶
Unload content cache.
- class mstrio.project_objects.content_cache.ContentCacheFormat(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- BINARY_DATA = 'binary_data'¶
- BINARY_DEFINITION = 'binary_definition'¶
- CSV = 'csv'¶
- EXCEL = 'excel'¶
- FLASH = 'flash'¶
- HTML = 'html'¶
- HTML5 = 'html5'¶
- PDF = 'pdf'¶
- PLAIN_TEXT = 'plain_text'¶
- TRANSACTION = 'transaction'¶
- XML = 'xml'¶
mstrio.project_objects.document module¶
- class mstrio.project_objects.document.Document(connection: Connection, name: Optional[str] = None, id: Optional[str] = None)¶
Bases:
Entity
,VldbMixin
,CopyMixin
,MoveMixin
,DeleteMixin
,ContentCacheMixin
Python representation of MicroStrategy Document object
_CACHE_TYPE is a variable used by ContentCache class for cache filtering purposes.
- alter(name: Optional[str] = None, description: Optional[str] = None, folder_id: Optional[Union[Folder, str]] = None)¶
Alter Document name, description and/or folder id.
- Parameters:
name (string, optional) – new name of the Document
description (string, optional) – new description of the Document
folder_id (string | Folder, optional) – A globally unique identifier used to distinguish between metadata objects within the same project. It is possible for two metadata objects in different projects to have the same Object Id.
- get_connected_cubes() list[mstrio.project_objects.datasets.super_cube.SuperCube | mstrio.project_objects.datasets.olap_cube.OlapCube] ¶
Lists cubes used by this document.
- Returns:
A list of cubes used by the document.
- list_available_schedules(to_dictionary: bool = False) list[mstrio.distribution_services.schedule.schedule.Schedule] | list[dict] ¶
Get a list of schedules available for the object instance.
- Parameters:
to_dictionary (bool, optional) – If True returns a list of dictionaries, otherwise returns a list of Schedules. False by default.
- Returns:
List of Schedule objects or list of dictionaries.
- list_properties()¶
List properties for the document.
- Returns:
A list of all document properties.
- publish(recipients: Optional[Union[str, User, UserGroup, list[Union[str, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.UserGroup]]]] = None)¶
Publish the document for authenticated user. If recipients parameter is specified publishes the document for the given users.
- Parameters:
recipients (UserOrGroup | list[UserOrGroup], optional) – list of users or user groups to publish the document to (can be a list of IDs or a list of User and UserGroup elements)
Shares the document to the listed users’ libraries.
- Parameters:
users (UserOrGroup | list[UserOrGroup]) – list of users or user groups to publish the document to (can be a list of IDs or a list of User and UserGroup elements).
- unpublish(recipients: Optional[Union[str, User, UserGroup, list[Union[str, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.UserGroup]]]] = None)¶
Unpublish the document for all users it was previously published to. If recipients parameter is specified unpublishes the document for the given users.
- Parameters:
recipients (UserOrGroup | list[UserOrGroup], optional) – list of users or user groups to publish the document to (can be a list of IDs or a list of User and UserGroup elements)
- mstrio.project_objects.document.list_documents(connection: Connection, to_dictionary: bool = False, to_dataframe: bool = False, limit: Optional[int] = None, name: Optional[str] = None, project_id: Optional[str] = None, project_name: Optional[str] = None, **filters) list[mstrio.project_objects.document.Document] | list[dict] | pandas.core.frame.DataFrame ¶
Get all Documents available in the project specified within the connection object.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by ‘connection.Connection()’
to_dictionary (bool, optional) – if True, return Documents as list of dicts
to_dataframe (bool, optional) – if True, return Documents as pandas DataFrame
limit (int, optional) – limit the number of elements returned. If None (default), all objects are returned.
name (str, optional) – characters that the document name must contain
project_id (str, optional) – Project ID
project_name (str, optional) – Project name
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’, ‘view_media’, ‘certified_info’, ‘project_id’]
- Returns:
List of documents or list of dictionaries or DataFrame object
- mstrio.project_objects.document.list_documents_across_projects(connection: Connection, name: Optional[str] = None, to_dictionary: bool = False, to_dataframe: bool = False, limit: Optional[int] = None, **filters) list[mstrio.project_objects.document.Document] | list[dict] | pandas.core.frame.DataFrame ¶
Get all Documents stored on the server.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (Connection) – MicroStrategy connection object returned by ‘connection.Connection()’
name (string, optional) – characters that the document name must contain
to_dictionary (bool, optional) – if True, return Documents as list of dicts
to_dataframe (bool, optional) – if True, return Documents as pandas DataFrame
limit (int, optional) – 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’, ‘ext_type’, ‘view_media’, ‘certified_info’, ‘project_id’]
- Returns:
List of documents or list of dictionaries or DataFrame object
mstrio.project_objects.dossier module¶
- class mstrio.project_objects.dossier.ChapterPage(key: str, visualizations: list[mstrio.project_objects.dossier.PageVisualization], name: Optional[str] = None, selectors: Optional[list[mstrio.project_objects.dossier.PageSelector]] = None)¶
Bases:
Dictable
Object that describes a Chapter Page
- key¶
key/id of the page
- Type:
string
- visualizations¶
list of visualizations on the page
- Type:
list[PageVisualization]
- name¶
name of the page
- Type:
string, optional
- selectors¶
list of selectors on the page
- Type:
list[PageSelector], optional
- key: str¶
- list_properties(camel_case=True) dict ¶
Lists properties of dossier chapter page.
- name: Optional[str] = None¶
- selectors: Optional[list[mstrio.project_objects.dossier.PageSelector]] = None¶
- visualizations: list[mstrio.project_objects.dossier.PageVisualization]¶
- class mstrio.project_objects.dossier.Dossier(connection: Connection, name: Optional[str] = None, id: Optional[str] = None)¶
Bases:
Document
- alter(name: Optional[str] = None, description: Optional[str] = None, folder_id: Optional[Union[Folder, str]] = None)¶
Alter Dossier name, description and/or folder id.
- Parameters:
name (string, optional) – new name of the Dossier
description (string, optional) – new description of the Dossier
folder_id (string | Folder, optional) – A globally unique identifier used to distinguish between metadata objects within the same project. It is possible for two metadata objects in different projects to have the same Object Id.
- list_properties() dict ¶
List properties for the dossier.
- publish(recipients: Optional[Union[str, User, UserGroup, list[Union[str, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.UserGroup]]]] = None)¶
Publish the dossier for authenticated user. If recipients parameter is specified publishes the dossier for the given users.
- Parameters:
recipients (UserOrGroup | list[UserOrGroup], optional) – list of users or user groups to publish the dossier to (can be a list of IDs or a list of User and UserGroup elements)
Shares the dossier to the listed users’ libraries.
- Parameters:
users (UserOrGroup | list[UserOrGroup]) – list of users or user groups to publish the dossier to (can be a list of IDs or a list of User and UserGroup elements).
- unpublish(recipients: Optional[Union[str, User, UserGroup, list[Union[str, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.UserGroup]]]] = None)¶
Unpublish the dossier for all users it was previously published to. If recipients parameter is specified unpublishes the dossier for the given users.
- Parameters:
recipients (UserOrGroup | list[UserOrGroup], optional) – list of users or user groups to publish the dossier to (can be a list of IDs or a list of User and UserGroup elements)
- class mstrio.project_objects.dossier.DossierChapter(key: str, pages: list[mstrio.project_objects.dossier.ChapterPage], name: Optional[str] = None, filters: Optional[list[dict]] = None)¶
Bases:
Dictable
Object that describes a Dossier Chapter
- key¶
key/id of the chapter
- Type:
string
- pages¶
list of the chapter pages
- Type:
list[ChapterPage]
- name¶
name of the chapter
- Type:
string, optional
- filters¶
(dict, optional): filters for the chapter
- Type:
Optional[list[dict]]
- filters: Optional[list[dict]] = None¶
- key: str¶
- list_properties(camel_case=True) dict ¶
Lists properties of dossier chapter.
- name: Optional[str] = None¶
- pages: list[mstrio.project_objects.dossier.ChapterPage]¶
- class mstrio.project_objects.dossier.PageSelector(key: str, selector_type: str, current_selection: dict, source: Optional[dict] = None, multi_selection_allowed: bool = False, has_all_option: bool = False, display_style: Optional[str] = None, available_object_items: Optional[list[dict]] = None, targets: Optional[list[dict]] = None, name: Optional[str] = None, summary: Optional[str] = None)¶
Bases:
Dictable
Object that describes a Page Selector
- key¶
key/id of the selector
- Type:
string
- selector_type¶
type of the selector
- Type:
string
- current_selection¶
current selection of the selector
- Type:
dict
- source¶
source of the selector
- Type:
dict, optional
- multi_selection_allowed¶
whether multi selection is allowed, defaults to False
- Type:
bool
- has_all_option¶
whether the selector has all options enabled, defaults to False
- Type:
bool
- display_style¶
style of the selector display
- Type:
string, optional
- available_object_items¶
list of objects available for the selector
- Type:
list[dict], optional
- targets¶
list of targets of the selector
- Type:
list[dict], optional
- name¶
name of the selector
- Type:
string, optional
- summary¶
summary of the selector
- Type:
string, optional
- available_object_items: Optional[list[dict]] = None¶
- current_selection: dict¶
- display_style: Optional[str] = None¶
- has_all_option: bool = False¶
- key: str¶
- list_properties(camel_case=True) dict ¶
Lists properties of page selector.
- multi_selection_allowed: bool = False¶
- name: Optional[str] = None¶
- selector_type: str¶
- source: Optional[dict] = None¶
- summary: Optional[str] = None¶
- targets: Optional[list[dict]] = None¶
- class mstrio.project_objects.dossier.PageVisualization(key: str, visualization_type: Optional[str] = None, name: Optional[str] = None, selector: Optional[VisualizationSelector] = None)¶
Bases:
Dictable
Object that describes a Visualization on a Page
- key¶
key/id of the visualization
- Type:
string
- visualization_type¶
type of the visualization
- Type:
string, optional
- name¶
name of the visualization
- Type:
string, optional
- selector¶
selector for the visualization
- Type:
VisualizationSelector, optional
- key: str¶
- list_properties(camel_case=True) dict ¶
Lists properties of page visualization.
- name: Optional[str] = None¶
- selector: Optional[VisualizationSelector] = None¶
- visualization_type: Optional[str] = None¶
- class mstrio.project_objects.dossier.VisualizationSelector(visualization_key: str, selector_type: str, current_selection: dict, targets: Optional[list[dict]] = None)¶
Bases:
Dictable
Object that describes a Visualization Selector
- visualization_key¶
key/id of the selector
- Type:
string
- selector_type¶
type of the selector
- Type:
string
- current_selection¶
current selection of the selector
- Type:
dict
- targets¶
list of the selector’s targets
- Type:
list[dict], optional
- current_selection: dict¶
- list_properties(camel_case=True) dict ¶
Lists properties of visualization selector.
- selector_type: str¶
- targets: Optional[list[dict]] = None¶
- visualization_key: str¶
- mstrio.project_objects.dossier.list_dossiers(connection: Connection, name: Optional[str] = None, to_dictionary: bool = False, to_dataframe: bool = False, limit: Optional[int] = None, project_id: Optional[str] = None, project_name: Optional[str] = None, **filters) list[mstrio.project_objects.dossier.Dossier] | list[dict] | pandas.core.frame.DataFrame ¶
Get all Dossiers stored on the server.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (object) – MicroStrategy connection object returned by ‘connection.Connection()’
name – characters that the dossier name must contain
to_dictionary (bool, optional) – if True, return Dossiers as list of dicts
to_dataframe (bool, optional) – if True, return Dossiers as pandas DataFrame
limit (int) – limit the number of elements returned. If None (default), all objects are returned.
project_id (str, optional) – Project ID
project_name (str, optional) – Project name
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’, ‘view_media’, ‘certified_info’, ‘project_id’]
- Returns:
List of dossiers or list of dictionaries or DataFrame object
- mstrio.project_objects.dossier.list_dossiers_across_projects(connection: Connection, name: Optional[str] = None, to_dictionary: bool = False, to_dataframe: bool = False, limit: Optional[int] = None, **filters) list[mstrio.project_objects.dossier.Dossier] | list[dict] | pandas.core.frame.DataFrame ¶
Get all Dossiers stored on the server.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (object) – MicroStrategy connection object returned by ‘connection.Connection()’
name – characters that the dossier name must contain
to_dictionary (bool, optional) – if True, return Dossiers as list of dicts
to_dataframe (bool, optional) – if True, return Dossiers as pandas DataFrame
limit – 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’, ‘ext_type’, ‘view_media’, ‘certified_info’, ‘project_id’]
- Returns:
List of dossiers or list of dictionaries or DataFrame object
mstrio.project_objects.library module¶
- class mstrio.project_objects.library.Library(connection: Connection, project_id: Optional[str] = None, project_name: Optional[str] = None)¶
Bases:
object
mstrio.project_objects.report module¶
- class mstrio.project_objects.report.Report(connection: Connection, id: str, instance_id: Optional[str] = None, parallel: bool = True, progress_bar: bool = True)¶
Bases:
Entity
,CertifyMixin
,CopyMixin
,MoveMixin
,DeleteMixin
,ContentCacheMixin
Access, filter, publish, and extract data from in-memory reports.
Create a Report object to load basic information on a report dataset. Specify subset of report to be fetched through Report.apply_filters() and Report.clear_filters(). Fetch dataset through Report.to_dataframe() method.
_CACHE_TYPE is a variable used by ContentCache class for cache filtering purposes.
- connection¶
MicroStrategy connection object returned by connection.Connection().
- id¶
Identifier of a pre-existing report containing the required data.
- name¶
Report name
- description¶
Report description
- abbreviation¶
Report abbreviation
- instance_id¶
Identifier of an instance if report instance has been already initialized, NULL by default.
- 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 User object
- view_media¶
View media information
- ancestors¶
List of ancestor folders
- certified_info¶
Information whether report is certified or not, CertifiedInfo object
- attributes¶
List of attributes
- metrics¶
List of metrics
- attr_elements¶
All attributes elements of report
- selected_attributes¶
IDs of filtered attributes
- selected_metrics¶
IDs of filtered metrics
- selected_attr_elements¶
IDs of filtered attribute elements
- dataframe¶
content of a report extracted into a Pandas DataFrame
- acg¶
Access rights (See EnumDSSXMLAccessRightFlags for possible values)
- acl¶
Object access control list
- alter(name: Optional[str] = None, description: Optional[str] = None, abbreviation: Optional[str] = None)¶
Alter Report properties.
- Parameters:
name – new name of the Report
description – new description of the Report
abbreviation – new abbreviation of the Report
- apply_filters(attributes: Optional[list] = None, metrics: Optional[list] = None, attr_elements: Optional[list] = None, operator: str = 'In') None ¶
Apply filters on the reports’s objects.
Filter by attributes, metrics and attribute elements.
- Parameters:
attributes (list or None, optional) – ids of attributes to be included in the filter. If list is empty, no attributes will be selected and metric data will be aggregated.
metrics (list or None, optional) – ids of metrics to be included in the filter. If list is empty, no metrics will be selected.
attr_elements (list or None, optional) – attribute elements to be included in the filter.
operator (str, optional) – a str flag used to specify if the attribute elements selected inside the filter should be included or excluded. Allowed values are: ‘In’, ‘NotIn’.
- clear_filters() None ¶
Clear previously set filters, allowing all attributes, metrics, and attribute elements to be retrieved.
- list_available_schedules(to_dictionary: bool = False) list[mstrio.distribution_services.schedule.schedule.Schedule] | list[dict] ¶
Get a list of schedules available for the report.
- Parameters:
to_dictionary (bool, optional) – If True returns a list of dictionaries, otherwise returns a list of Schedules. False by default.
- Returns:
List of Schedule objects or list of dictionaries.
- list_properties()¶
List all properties of the object.
- to_dataframe(limit: Optional[int] = None) DataFrame ¶
Extract contents of a report instance into a Pandas DataFrame.
- Parameters:
limit (None or int, optional) – Used to control data extract behavior. By default (None) the limit is calculated automatically, based on an optimized physical size of one chunk. Setting limit manually will force the number of rows per chunk. Depending on system resources, a higher limit (e.g. 50,000) may reduce the total time required to extract the entire dataset.
- Returns:
Pandas Data Frame containing the report contents.
- mstrio.project_objects.report.list_reports(connection: Connection, name: Optional[str] = None, search_pattern: mstrio.object_management.search_enums.SearchPattern | int = SearchPattern.CONTAINS, project_id: Optional[str] = None, project_name: Optional[str] = None, to_dictionary: bool = False, limit: Optional[int] = None, folder_id: Optional[str] = None, **filters) list[Type[mstrio.project_objects.report.Report]] | list[dict] ¶
Get list of Report objects or dicts with them. Optionally filter reports by specifying ‘name’.
Optionally use to_dictionary to choose output format.
- Wildcards available for ‘name’:
? - any character * - 0 or more of any characters e.g. name = ?onny will return Sonny and Tonny
Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.
Note
When project_id is None and project_name is None, then its value is overwritten by project_id from connection object.
- Parameters:
connection – MicroStrategy connection object returned by connection.Connection()
name (string, optional) – value the search pattern is set to, which will be applied to the names of reports being searched
to_dictionary (bool, optional) – If True returns dict, by default (False) returns Report objects
search_pattern (SearchPattern enum or int, optional) – pattern to search for, such as Begin With or Contains. Possible values are available in ENUM mstrio.object_management.SearchPattern. Default value is BEGIN WITH (4).
project_id (string, optional) – Project ID
project_name (string, optional) – Project name
limit (integer, optional) – limit the number of elements returned. If None all object are returned.
folder_id (string, optional) – ID of a folder where the search will be performed. Defaults to None.
**filters – Available filter parameters: [‘id’, ‘name’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘owner’, ‘ext_type’, ‘view_media’, ‘certified_info’]
- Returns:
list with Report objects or list of dictionaries