mstrio.project_objects package

Subpackages

Submodules

mstrio.project_objects.document module

class mstrio.project_objects.document.Document(connection: mstrio.connection.Connection, name: Optional[str] = None, id: Optional[str] = None)

Bases: mstrio.utils.entity.Entity, mstrio.utils.entity.VldbMixin, mstrio.utils.entity.CopyMixin, mstrio.utils.entity.MoveMixin, mstrio.utils.entity.DeleteMixin

alter(name: Optional[str] = None, description: Optional[str] = None)

Alter Document name or/and description.

Parameters
  • name – new name of the Document

  • description – new description of the Document

get_connected_cubes()

Lists cubes used by this document.

publish(recipients: Optional[Union[str, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.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 (list) – 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)

share_to(users: Union[str, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.UserGroup, List[Union[str, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.UserGroup]]])

Shares the document to the listed users’ libraries.

Parameters

users (list) – 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, mstrio.users_and_groups.user.User, mstrio.users_and_groups.user_group.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 (list) – 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: mstrio.connection.Connection, name: Optional[str] = None, to_dictionary: bool = False, to_dataframe: bool = False, limit: Optional[int] = None, **filters)

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 (object) – MicroStrategy connection object returned by ‘connection.Connection()’

  • name – exact name of the document to list

  • to_dictionary (bool, optional) – if True, return Documents as list of dicts

  • to_dataframe (bool, optional) – if True, return Documents 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 documents.

mstrio.project_objects.document.list_documents_across_projects(connection: mstrio.connection.Connection, name: Optional[str] = None, to_dictionary: bool = False, to_dataframe: bool = False, limit: Optional[int] = None, **filters)

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 (object) – MicroStrategy connection object returned by ‘connection.Connection()’

  • name – exact names of the documents to list

  • to_dictionary (bool, optional) – if True, return Documents as list of dicts

  • to_dataframe (bool, optional) – if True, return Documents 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 documents.

mstrio.project_objects.dossier module

class mstrio.project_objects.dossier.Dossier(connection: mstrio.connection.Connection, name: Optional[str] = None, id: Optional[str] = None)

Bases: mstrio.project_objects.document.Document

mstrio.project_objects.dossier.list_dossiers(connection: mstrio.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]

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 – exact name of the document to list

  • 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 to a sample of dossiers

  • **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.

mstrio.project_objects.dossier.list_dossiers_across_projects(connection: mstrio.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]

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 – exact names of the dossiers to list

  • 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 documents.

mstrio.project_objects.library module

class mstrio.project_objects.library.Library(connection)

Bases: object

publish(contents: Union[List, Document, Dossier, str])

Publishes dossier or document to the authenticated user’s library.

contents: dossiers or documents to be published, can be Dossier/Document

class object or ID

unpublish(contents: Union[List, Document, Dossier, str])

Publishes dossier or document to the authenticated user’s library.

contents: dossiers or documents to be published, can be Dossier/Document

class object or ID

mstrio.project_objects.report module

class mstrio.project_objects.report.Report(connection: mstrio.connection.Connection, id: str, instance_id: Optional[str] = None, parallel: bool = True, progress_bar: bool = True)

Bases: mstrio.utils.entity.Entity, mstrio.utils.entity.CertifyMixin, mstrio.utils.entity.CopyMixin, mstrio.utils.entity.MoveMixin, mstrio.utils.entity.DeleteMixin

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.

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

List all properties of the object.

to_dataframe(limit: Optional[int] = None) pandas.core.frame.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: mstrio.connection.Connection, name: Optional[str] = None, name_begins: Optional[str] = None, search_pattern: Union[mstrio.object_management.search_enums.SearchPattern, int] = SearchPattern.CONTAINS, project_id: Optional[str] = None, to_dictionary: bool = False, limit: Optional[int] = None, **filters) Union[List[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_begins’:

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

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

  • name_begins (string, optional) – deprecated. Use name instead.

  • 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.browsing.SearchPattern. Default value is BEGIN WITH (4).

  • project_id (string, optional) – Project ID

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

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

Returns

list with Report objects or list of dictionaries

Module contents