mstrio package

Subpackages

Submodules

mstrio.config module

mstrio.config.custom_formatwarning(msg, category, *args, **kwargs)

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) Optional[mstrio.connection.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. :param workstation_data: object which is stored in a ‘workstationData’

variable within Workstation

Parameters
  • project_name (str, optional) – name of project (aka project) to select

  • project_id (str, optional) – id of project (aka project) to select

Returns

connection to I-Server or None is case of some error

mstrio.types module

class mstrio.types.ExtendedType(value)

Bases: enum.Enum

An enumeration.

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)

Bases: enum.Enum

An enumeration.

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
MD_SECURITY_FILTER = 14848
NONE = None
OLAP_CUBE = 776
SEARCH = 9984
SUPER_CUBE = 779
USER = 8704
USER_GROUP = 8705
class mstrio.types.ObjectTypes(value)

Bases: enum.Enum

An enumeration.

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