mstrio package¶
Subpackages¶
- mstrio.access_and_security package
- mstrio.datasources package
- mstrio.distribution_services package
- Subpackages
- mstrio.distribution_services.device package
- mstrio.distribution_services.schedule package
- mstrio.distribution_services.subscription package
- Submodules
- mstrio.distribution_services.subscription.base_subscription module
- mstrio.distribution_services.subscription.cache_update_subscription module
- mstrio.distribution_services.subscription.common module
- mstrio.distribution_services.subscription.content module
- mstrio.distribution_services.subscription.delivery module
- mstrio.distribution_services.subscription.dynamic_recipient_list module
- mstrio.distribution_services.subscription.email_subscription module
- mstrio.distribution_services.subscription.file_subscription module
- mstrio.distribution_services.subscription.ftp_subscription module
- mstrio.distribution_services.subscription.history_list_subscription module
- mstrio.distribution_services.subscription.subscription_manager module
- Module contents
- mstrio.distribution_services.transmitter package
- Submodules
- mstrio.distribution_services.event module
- Module contents
- Subpackages
- mstrio.modeling package
- Subpackages
- mstrio.modeling.expression package
- Submodules
- mstrio.modeling.expression.dynamic_date_time module
- mstrio.modeling.expression.enums module
- mstrio.modeling.expression.expression module
- mstrio.modeling.expression.expression_nodes module
- mstrio.modeling.expression.fact_expression module
- mstrio.modeling.expression.parameters module
- Module contents
- mstrio.modeling.filter package
- mstrio.modeling.metric package
- mstrio.modeling.schema package
- mstrio.modeling.security_filter package
- mstrio.modeling.expression package
- Module contents
- Subpackages
- mstrio.object_management package
- Subpackages
- Submodules
- mstrio.object_management.folder module
- mstrio.object_management.object module
- mstrio.object_management.predefined_folders module
- mstrio.object_management.search_enums module
- mstrio.object_management.search_operations module
- mstrio.object_management.shortcut module
- Module contents
- mstrio.project_objects package
- Subpackages
- Submodules
- mstrio.project_objects.content_cache module
- mstrio.project_objects.document module
- mstrio.project_objects.dossier module
- mstrio.project_objects.library module
- mstrio.project_objects.report module
- Module contents
- mstrio.server package
- mstrio.users_and_groups package
- mstrio.utils package
- Subpackages
- Submodules
- mstrio.utils.acl module
- mstrio.utils.api_helpers module
- mstrio.utils.cache module
- mstrio.utils.certified_info module
- mstrio.utils.datasources module
- mstrio.utils.dependence_mixin module
- mstrio.utils.dict_filter module
- mstrio.utils.encoder module
- mstrio.utils.entity module
- mstrio.utils.enum_helper module
- mstrio.utils.error_handlers module
- mstrio.utils.exceptions module
- mstrio.utils.filter module
- mstrio.utils.formjson module
- mstrio.utils.helper module
- mstrio.utils.model module
- mstrio.utils.monitors module
- mstrio.utils.object_mapping module
- mstrio.utils.parser module
- mstrio.utils.progress_bar_mixin module
- mstrio.utils.sessions module
- mstrio.utils.time_helper module
- mstrio.utils.version_helper module
- mstrio.utils.wip module
- Module contents
Submodules¶
mstrio.config module¶
- mstrio.config.custom_formatwarning(msg, category, *args, **kwargs)¶
- mstrio.config.get_logging_level() int ¶
Calculate and return logging level to configure logger.
- mstrio.config.toggle_debug_mode() None ¶
Toggle debug mode between INFO and DEBUG. It will change root logger’s logging level.
mstrio.connection module¶
- class mstrio.connection.Connection(base_url: str, username: Optional[str] = None, password: Optional[str] = None, project_name: Optional[str] = None, project_id: Optional[str] = None, login_mode: int = 1, ssl_verify: bool = True, certificate_path: Optional[str] = None, proxies: Optional[dict] = None, identity_token: Optional[str] = None, verbose: bool = True)¶
Bases:
object
Connect to and interact with the MicroStrategy environment.
Creates a connection object which is used in subsequent requests and manages the user’s connection with the MicroStrategy REST and Intelligence Servers. The connection is automatically renewed, or reconnected if server’s session associated with the connection expires due to inactivity.
Examples
>>> from mstrio import connection >>> >>> # connect to the environment and chosen project >>> conn = connection.Connection( >>> base_url="https://demo.microstrategy.com/MicroStrategyLibrary", >>> username="username", >>> password="password", >>> project_name="MicroStrategy Tutorial" >>> ) >>> # disconnect >>> conn.close()
- base_url¶
URL of the MicroStrategy REST API server.
- username¶
Username.
- project_name¶
Name of the connected MicroStrategy Project.
- project_id¶
Id of the connected MicroStrategy Project.
- login_mode¶
Authentication mode. Standard = 1 (default) or LDAP = 16.
- ssl_verify¶
If True (default), verifies the server’s SSL certificates with each request.
- user_id¶
Id of the authenticated user
- user_full_name¶
Full name of the authenticated user
- user_initials¶
Initials of the authenticated user
- iserver_version¶
Version of the I-Server
- web_version¶
Version of the Web Server
- token¶
authentication token
- timeout¶
time after the server’s session expires, in seconds
- close()¶
Closes a connection with MicroStrategy REST API.
- connect() None ¶
Authenticates the user and creates a new connection with the Intelligence Server.
If an active connection is detected, the session is renewed.
- delegate()¶
Delegates identity token to get authentication token and connect to MicroStrategy Intelligence Server.
- delete(url, **kwargs)¶
- get(url, **kwargs)¶
- get_identity_token() str ¶
Create new identity token using existing authentication token.
- head(url, **kwargs)¶
- patch(url, **kwargs)¶
- post(url, **kwargs)¶
- put(url, **kwargs)¶
- renew() None ¶
Authenticates the user and creates a new connection with the Intelligence Server.
If an active connection is detected, the session is renewed.
- select_project(project_id: Optional[str] = None, project_name: Optional[str] = None) None ¶
Select project for the given connection based on project_id or project_name.
When both project_id and project_name are None, project selection is cleared. When both project_id and project_name are provided, project_name is ignored.
- Parameters:
project_id – id of project to select
project_name – name of project to select
- Raises:
ValueError – if project with given id or name does not exist
- status() bool ¶
Checks if the session is still alive.
- Raises:
HTTPError if I-Server behaves unexpectedly –
- validate_identity_token() bool ¶
Validate the identity token.
- mstrio.connection.get_connection(workstation_data: dict, project_name: Optional[str] = None, project_id: Optional[str] = None, ssl_verify: bool = False) Optional[Connection] ¶
Connect to environment without providing user’s credentials.
It is possible to provide project_id or project_name to select project. When both project_id and project_name are None, project selection is cleared. When both project_id and project_name are provided, project_name is ignored. Project can be also selected later by calling method select_project on Connection object.
Note
- ssl_verify is set to False by default just for the get_connection
function as it is designed for usage inside Workstation. When ssl_verify is set to False, warning about missing certificate verification (InsecureRequestWarning) is disabled.
- Parameters:
workstation_data (object) – object which is stored in a ‘workstationData’ variable within Workstation
project_name (str, optional) – name of project (aka project) to select
project_id (str, optional) – id of project (aka project) to select
ssl_verify (bool, optional) – If False (default), does not verify the server’s SSL certificates
- Returns:
connection to I-Server or None is case of some error
mstrio.types module¶
- class mstrio.types.ExtendedType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
- CUSTOM_SQL_FREE_FORM = 3¶
- CUSTOM_SQL_WIZARD = 4¶
- DATA_IMPORT_CUSTOM_SQL = 304¶
- DATA_IMPORT_CUSTOM_SQL_WIZARD = 352¶
- DATA_IMPORT_FILE_EXCEL = 272¶
- DATA_IMPORT_FILE_TEXT = 288¶
- DATA_IMPORT_GENERAL = 256¶
- DATA_IMPORT_OAUTH = 336¶
- DATA_IMPORT_OAUTH_DROPBOX = 339¶
- DATA_IMPORT_OAUTH_GDRIVE = 338¶
- DATA_IMPORT_OAUTH_SFDC = 337¶
- DATA_IMPORT_SPARK = 416¶
- DATA_IMPORT_TABLE = 320¶
- MDX = 2¶
- RELATIONAL = 1¶
- RESERVED = 0¶
- class mstrio.types.ObjectSubTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
- ATTRIBUTE = 3072¶
- ATTRIBUTE_ABSTRACT = 3075¶
- ATTRIBUTE_FORM = 5376¶
- ATTRIBUTE_RECURSIVE = 3076¶
- ATTRIBUTE_ROLE = 3073¶
- ATTRIBUTE_TRANSFORMATION = 3074¶
- FILTER = 256¶
- FUNCTION = 2816¶
- FUNCTION_PACKAGE_DEFINITION = 10752¶
- INCREMENTAL_REFRESH_REPORT = 777¶
- MD_SECURITY_FILTER = 14848¶
- NONE = None¶
- OLAP_CUBE = 776¶
- REPORT_ENGINE = 770¶
- REPORT_GRAPH = 769¶
- REPORT_GRID = 768¶
- REPORT_GRID_AND_GRAPH = 774¶
- REPORT_HYPER_CARD = 781¶
- REPORT_TRANSACTION = 778¶
- REPORT_WRITING_DOCUMENT = 14081¶
- ROLE_TRANSFORMATION = 11009¶
- SEARCH = 9984¶
- SUPER_CUBE = 779¶
- USER = 8704¶
- USER_GROUP = 8705¶
- class mstrio.types.ObjectTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
- AGG_METRIC = 7¶
- ATTRIBUTE = 12¶
- ATTRIBUTE_FORM = 21¶
- COLUMN = 26¶
- CONFIGURATION = 36¶
- CONSOLIDATION = 47¶
- DBCONNECTION = 31¶
- DBLOGIN = 30¶
- DBMS = 57¶
- DBROLE = 29¶
- DBTABLE = 53¶
- DIMENSION = 14¶
- DOCUMENT_DEFINITION = 55¶
- DRILL_MAP = 56¶
- FACT = 13¶
- FILTER = 1¶
- FOLDER = 8¶
- FUNCTION = 11¶
- LOCALE = 45¶
- METRIC = 4¶
- MONITOR = 20¶
- NONE = None¶
- PROJECT = 32¶
- PROMPT = 10¶
- PROPERTY_SET = 28¶
- REPORT_DEFINITION = 3¶
- ROLE = 43¶
- SCHEDULE_EVENT = 49¶
- SCHEDULE_OBJECT = 50¶
- SCHEDULE_TRIGGER = 51¶
- SEARCH = 39¶
- SECURITY_FILTER = 58¶
- SECURITY_ROLE = 44¶
- SHORTCUT = 67¶
- SHORTCUT_TARGET = 68¶
- SHORTCUT_TYPE = 18¶
- SUBSCRIPTION_DEVICE = 9¶
- SUBSCRIPTION_TRANSMITTER = 35¶
- TABLE = 15¶
- USER = 34¶
- USERGROUP = 34¶
- static contains(item)¶
Module contents¶
mstrio: Simple and Secure Access to MicroStrategy Data
Mstrio provides a high-level interface for Python and is designed to give data scientists, developers, and administrators simple and secure access to their MicroStrategy environment.
It wraps MicroStrategy REST APIs into simple workflows, allowing users to fetch data from cubes and reports, create new datasets, add new data to existing datasets, and manage Users/User Groups, Servers, Projects, and more. Since it enforces MicroStrategy’s user and object security model, you don’t need to worry about setting up separate security rules.
With mstrio-py for data science, it’s easy to integrate cross-departmental, trustworthy business data in machine learning workflows and enable decision-makers to take action on predictive insights in MicroStrategy Reports, Dossiers, HyperIntelligence Cards, and customized, embedded analytical applications.
With mstrio-py for system administration, it’s easy to minimize costs by automating critical, time-consuming administrative tasks, even enabling administrators to leverage the power of Python to address complex administrative workflows for maintaining a MicroStrategy environment.
MicroStrategy for Jupyter is an extension for Jupyter Notebook which provides a graphical user interface for mstrio-py methods with the help of which user can perform all of the import and export actions without writing a single line of code manually. MicroStrategy for Jupyter is contained within mstrio-py package and is available after installation and enabling as Jupyter extension.