mstrio.datasources package

Submodules

mstrio.datasources.database_connections module

class mstrio.datasources.database_connections.DatabaseConnections(connection: Connection)

Bases: object

Browse and manage database connections on the environment.

connection

A MicroStrategy connection object

disconnect_all_databases(force: bool = False) list[dict] | None

Disconnect all database connections.

Parameters:

force – if True, no additional prompt will be shown before disconnecting all connections

Returns:

  • list of statuses of disconnecting all connections with their ids

    and messages from the I-Server

  • in case of error it returns None

disconnect_database(connection_id: str, force: bool = False) bool

Disconnect database connections by passing in connection_id.

Parameters:
  • connection_id – Database Connection Instance Id

  • force – if True, no additional prompt will be shown before. Default False.

  • Returns – True for success. False otherwise.

list_connections(nodes: str | list[str] = None, limit: int | None = None, **filters) list[dict[str, Any]]
Get all active database connections. Optionally filter the

connections by specifying the filters keyword arguments.

Parameters:
  • nodes – Node (server) names on which databases will be disconnected.

  • limit – limit the number of elements returned. If None, all objects are returned.

  • **filters – Available filter parameters: [‘status’, ‘database_instance_name’, ‘database_instance_id’, ‘user_name’, ‘database_login_name’, ‘cluster_node’, ‘id’, ‘name’, ‘type’]

mstrio.datasources.datasource_connection module

class mstrio.datasources.datasource_connection.DatasourceConnection(connection: Connection, name: str | None = None, id: str | None = None)

Bases: Entity, CopyMixin, DeleteMixin, TranslationMixin

Datasource connection configuration object that represents a connection to the datasource.

connection

A MicroStrategy connection object.

id

Unique datasource connection ID.

name

Unique datasource connection name.

description

Datasource connection description.

execution_mode

ExecutionMode Enum specifying how SQL statements will be executed on a physical database connection made.

max_cancel_attempt_time

Number of seconds before being timed out when attempting to make a connection.

max_query_exe_time

Number of seconds during which a query must be executed before being timed out.

max_connection_attempt_time

Number of seconds connection attempts to be made before timing out.

connection_lifetime

Number of seconds of the connection lifetime.

connection_idle_timeout

Number of seconds before being timed out when the connection is idle.

char_encoding_windows

CharEncoding Enum specifying the encoding across connection for Windows drivers.

char_encoding_unix

CharEncoding Enum specifying the encoding across connection for Unix drivers.

table_prefix

String prefixed to the names of all temporary tables created by the Query Engine for this connection during report execution with this string.

connection_string

Database connection string.

parameterized_queries

Specifies whether parameterized queries are enabled.

extended_fetch

Specifies whether or not to use the extended fetch ODBC call to retrieve data from the database connection.

datasource_login

DatasourceLogin object or ID

database_type

Database type

database_version

Database version

driver_type

DriverType Enum specifying Driver used for database connection.

oauth_parameter

Used for authentication with oAuth.

type

Object type

subtype

Object subtype

date_created

Creation time, DateTime object

date_modified

Last modification time, DateTime object

owner

User object that is the owner

acg

Object access rights. It a bit vector where bits are defined at [EnumDSSXMLAccessRightFlags].

acl

Object access control list

iam

List of projects to which the fence is applied.

resource

The url of configured Web API for OAuth authentication usage.

scope

List of delegated permissions that the app is requesting.

enable_sso

Specifies whether to use Single Sign-On.

alter(name: str | None = None, description: str | None = None, execution_mode: str | mstrio.datasources.helpers.ExecutionMode = None, max_cancel_attempt_time: int | None = None, max_query_exe_time: int | None = None, max_connection_attempt_time: int | None = None, connection_lifetime: int | None = None, connection_idle_timeout: int | None = None, char_encoding_windows: str | mstrio.datasources.helpers.CharEncoding = None, char_encoding_unix: str | mstrio.datasources.helpers.CharEncoding = None, table_prefix: str | None = None, connection_string: str | None = None, parameterized_queries: bool | None = None, extended_fetch: bool | None = None, driver_type: str | mstrio.datasources.helpers.DriverType = None, database_type: str | None = None, database_version: str | None = None, datasource_login: str | mstrio.datasources.datasource_login.DatasourceLogin | None = None, iam: dict | None = None, resource: str | None = None, scope: str | None = None, enable_sso: bool | None = None, comments: str | None = None) None

Alter the datasource connection properties.

Parameters:
  • name – Unique datasource connection name.

  • description – Datasource connection description.

  • execution_mode – ExecutionMode Enum specifying how SQL statements will be executed on a physical database connection made.

  • max_cancel_attempt_time – Number of seconds before being timed out when attempting to make a connection.

  • max_query_exe_time – Number of seconds during which a query must be executed before being timed out.

  • max_connection_attempt_time – Number of seconds connection attempts to be made before timing out.

  • connection_lifetime – Number of seconds of the connection lifetime.

  • connection_idle_timeout – Number of seconds before being timed out when the connection is idle.

  • char_encoding_windows – CharEncoding Enum specifying the encoding across connection for Windows drivers.

  • char_encoding_unix – CharEncoding Enum specifying the encoding across connection for Unix drivers.

  • table_prefix – String prefixed to the names of all temporary tables created by the Query Engine for this connection during report execution with this string.

  • connection_string – Database connection string.

  • parameterized_queries – Specifies whether parameterized queries are enabled.

  • extended_fetch – Specifies whether or not to use the extended fetch ODBC call to retrieve data from the database connection.

  • driver_type – DriverType Enum specifying Driver used for database connection.

  • datasource_loginDatasourceLogin object or ID

  • driver_type – ENUM Drivers used for database connection.

  • database_type – Database type

  • database_version – Database version

  • iam – List of projects to which the fence is applied.

  • resource – The url of configured Web API for OAuth authentication usage.

  • scope – List of delegated permissions that the app is requesting.

  • enable_sso – Specifies whether to use Single Sign-On.

  • comments – long description of the object

convert_to_dsn_less()

Convert datasource connection from DSN to DSN-less format and update the object to metadata.

classmethod create(connection: Connection, name: str, description: str | None = None, acg: int | None = None, execution_mode: str | mstrio.datasources.helpers.ExecutionMode = None, max_cancel_attempt_time: int | None = None, max_query_exe_time: int | None = None, max_connection_attempt_time: int | None = None, connection_lifetime: int | None = None, connection_idle_timeout: int | None = None, char_encoding_windows: str | mstrio.datasources.helpers.CharEncoding = None, char_encoding_unix: str | mstrio.datasources.helpers.CharEncoding = None, table_prefix: str | None = None, connection_string: str | None = None, parameterized_queries: bool = False, extended_fetch: bool = False, datasource_login: mstrio.datasources.datasource_login.DatasourceLogin | str | None = None, database_type: str | None = None, database_version: str | None = None, driver_type: str | mstrio.datasources.helpers.DriverType = None, oauth_parameter: str | None = None, iam: dict | None = None, resource: str | None = None, scope: str | None = None, enable_sso: bool = False) DatasourceConnection

Create a new datasource connection on the I-Server.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection().

  • name – Unique datasource connection name.

  • description – Datasource connection description.

  • acg – Object access rights. It’s a bit vector where bits are defined at [EnumDSSXMLAccessRightFlags].

  • execution_mode – ExecutionMode Enum specifying how SQL statements will be executed on a physical database connection made.

  • max_cancel_attempt_time – Number of seconds before being timed out when attempting to make a connection.

  • max_query_exe_time – Number of seconds during which a query must be executed before being timed out.

  • max_connection_attempt_time – Number of seconds connection attempts to be made before timing out.

  • connection_lifetime – Number of seconds of the connection lifetime.

  • connection_idle_timeout – Number of seconds before being timed out when the connection is idle.

  • char_encoding_windows – CharEncoding Enum specifying the encoding across connection for Windows drivers.

  • char_encoding_unix – CharEncoding Enum specifying the encoding across connection for Unix drivers.

  • table_prefix – String prefixed to the names of all temporary tables created by the Query Engine for this connection during report execution with this string.

  • connection_string – Database connection string.

  • parameterized_queries – Specifies whether parameterized queries are enabled.

  • extended_fetch – Specifies whether or not to use the extended fetch ODBC call to retrieve data from the database connection.

  • driver_type – DriverType Enum specifying Driver used for database connection.

  • oauth_parameter – Used for authentication with oAuth.

  • datasource_loginDatasourceLogin object or ID

  • database_type – Database type

  • database_version – Database version

  • iam – List of projects to which the fence is applied.

  • resource – The url of configured Web API for OAuth authentication usage.

  • scope – List of delegated permissions that the app is requesting.

  • enable_sso – Specifies whether to use Single Sign-On.

Returns:

DatasourceConnection object.

classmethod from_dict(source: dict[str, Any], connection: Connection, to_snake_case: bool = True) DatasourceConnection | EmbeddedConnection

Create a DatasourceConnection object from a dictionary.

Parameters:
  • source – Dictionary with DatasourceConnection properties

  • connection – MicroStrategy connection object returned by connection.Connection().

  • to_snake_case – If True, keys in the source dictionary are converted to snake_case.

Returns:

DatasourceConnection object.

test_connection() bool

Test datasource connection object.

Returns:

True if connection can be established, else False.

mstrio.datasources.datasource_connection.list_datasource_connections(connection: Connection, to_dictionary: bool = False, limit: int | None = None, **filters) list['DatasourceConnection'] | list[dict]

Get list of DatasourceConnection objects or dicts. Optionally filter the connections by specifying filters.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • to_dictionary – If True returns dict, by default (False) returns User objects.

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘name’, ‘id’, ‘description’, ‘acg’, ‘execution_mode’, ‘max_cancel_attempt_time’, ‘max_query_exe_time’, ‘max_connection_attempt_time’, ‘connection_lifetime’, ‘connection_idle_timeout’, ‘char_encoding_windows’, ‘char_encoding_unix’, ‘table_prefix’, ‘connection_string’, ‘parameterized_queries’, ‘extended_fetch’, ‘driver_type’, ‘oauth_parameter’, ‘iam’, ‘resource’, ‘scope’, ‘enable_sso’, ‘datasource_login’, ‘database_type’, ‘database_version’]

Examples

>>> list_datasource_connections(connection, name='db_conn_name')

mstrio.datasources.datasource_instance module

class mstrio.datasources.datasource_instance.DatasourceInstance(connection: Connection, name: str | None = None, id: str | None = None)

Bases: Entity, CopyMixin, DeleteMixin, ModelVldbMixin, TranslationMixin

Object representation of MicroStrategy DataSource Instance object.

connection

A MicroStrategy connection object

id

Datasource Instance ID

name

Datasource Instance name

description

Datasource Instance description

dbms

The database management system (DBMS) object

database

Database object

datasource_type

DatasourceType Enum (reserved, normal, data_import, data_import_primary)

table_prefix

Table prefix

odbc_version

Odbc version ENUM

intermediate_store_db_name

Intermediate store DBName

intermediate_store_table_space_name

intermediate store table space name

type

Object type

subtype

Object subtype

date_created

Creation time, DateTime object

date_modified

Last modification time, DateTime object

owner

User object that is the owner

acg

Access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

Object access control list

alter(name: str | None = None, description: str | None = None, datasource_type: str | mstrio.datasources.datasource_instance.DatasourceType | None = None, table_prefix: str | None = None, odbc_version: str | None = None, intermediate_store_db_name: str | None = None, intermediate_store_table_space_name: str | None = None, dbms: str | mstrio.datasources.dbms.Dbms | None = None, datasource_connection: str | mstrio.datasources.datasource_connection.DatasourceConnection | None = None, primary_datasource: Optional[Union[str, DatasourceInstance]] = None, data_mart_datasource: Optional[Union[str, DatasourceInstance]] = None) None

Alter DatasourceInstance properties.

Parameters:
  • name – Datasource name

  • description – Datasource description

  • datasource_type – DatasourceType Enum (reserved, normal, data_import, data_import_primary)

  • table_prefix – Table prefix

  • odbc_version – Odbc version ENUM (version3x, version2x)

  • intermediate_store_db_name – Intermediate store DBName

  • intermediate_store_table_space_name – intermediate store table space name

  • dbms – The database management system (DBMS) object or ID

  • datasource_connectionDatasourceConnection object or ID

  • primary_datasourceDatasourceInstance object or ID

  • data_mart_datasourceDatasourceInstance object or ID

convert_ds_connection_to_dsn_less()

Convert datasource embedded connection from DSN to DSN-less format connection string and update the object to metadata.

classmethod create(connection: Connection, name: str, dbms: mstrio.datasources.dbms.Dbms | str, description: str | None = None, datasource_type: str | mstrio.datasources.datasource_instance.DatasourceType | None = None, table_prefix: str | None = None, odbc_version: str | None = None, intermediate_store_db_name: str | None = None, intermediate_store_table_space_name: str | None = None, datasource_connection: str | mstrio.datasources.datasource_connection.DatasourceConnection | None = None, database_type: str = None, database_version: str = None, primary_datasource: Optional[str | DatasourceInstance] = None, data_mart_datasource: Optional[str | DatasourceInstance] = None) Optional[DatasourceInstance]

Create a new DatasourceInstance object on I-Server.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection().

  • name – Datasource name

  • dbms – The database management system (DBMS) object or id

  • description – Datasource description

  • datasource_type – DatasourceType Enum (reserved, normal, data_import, data_import_primary)

  • table_prefix – Table prefix

  • odbc_version – Odbc version ENUM (version3x, version2x)

  • intermediate_store_db_name – Intermediate store DBName

  • intermediate_store_table_space_name – intermediate store table space name

  • datasource_connectionDatasourceConnection object or ID

  • database_type – Database type

  • database_version – Database version

  • primary_datasourceDatasourceInstance object or ID

  • data_mart_datasourceDatasourceInstance object or ID

Returns:

DatasourceInstance object.

execute_query(project_id: str | mstrio.server.project.Project, query: str, max_retries: int = 10, retry_delay: int = 5) dict

Execute an SQL query on the given datasource.

Parameters:
  • project_id (str | Project) – project ID

  • query (str) – query to be executed

  • max_retries (int, optional) – maximum number of retries in case the query execution fails. Default is 10.

  • retry_delay (int, optional) – time to wait between retries in seconds. Default is 5.

Returns:

Dictionary containing execution results data for the query.

class mstrio.datasources.datasource_instance.DatasourceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

DATA_IMPORT = 'data_import'
DATA_IMPORT_PRIMARY = 'data_import_primary'
NORMAL = 'normal'
RESERVED = 'reserved'
mstrio.datasources.datasource_instance.list_connected_datasource_instances(connection: Connection, to_dictionary: bool = False) list['DatasourceInstance'] | list[dict]

List all datasource instances for which there is an associated Database Login and are connected to a project mapped to a Connection object.

Parameters:
  • connection (Connection) – MicroStrategy connection object returned by connection.Connection()

  • to_dictionary (bool, optional) – If True returns a list of dictionaries representing datasource instances

Returns:

A list of connected

datasource instances.

Return type:

list[“DatasourceInstance”] | list[dict]

mstrio.datasources.datasource_instance.list_datasource_instances(connection: Connection, to_dictionary: bool = False, limit: int | None = None, ids: list[str] | None = None, database_types: list[str] | None = None, project: Optional[Project | str] = None, **filters) list['DatasourceInstance'] | list[dict]

Get list of DatasourceInstance objects or dicts. Optionally filter the datasource instances by specifying filters.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • to_dictionary – If True returns dict, by default (False) returns User objects.

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • ids – list of datasources ids as strings. By default None.

  • database_types – list of strings representing database types. By default None. Available values: [‘reserved’, ‘access’, ‘altibase’, ‘amazon_athena’, ‘amazon_aurora’, ‘amazon_redshift’, ‘arcadia_platform’, ‘aster’, ‘big_data_engine’, ‘cassandra’, ‘cirro’, ‘cloud_element’, ‘cloud_gateway’, ‘cloud_gateway_aws_s3’, ‘cloud_gateway_azure_adls_2’, ‘cloud_gateway_google_cloud_storage’, ‘composite’, ‘concur’, ‘connection_cloud’, ‘data_direct_cloud’, ‘datallegro’, ‘db2’, ‘denodo’, ‘drill’, ‘dropbox’, ‘eloqua’, ‘enterprise_db’, ‘ess_base’, ‘exa_solution’, ‘excel’, ‘facebook’, ‘gbase_8a’, ‘generic’, ‘generic_data_connector’, ‘google_analytics’, ‘google_big_query’, ‘google_big_query_ff_sql’, ‘google_drive’, ‘hive’, ‘hive_thrift’, ‘hubspot’, ‘impala’, ‘informatica’, ‘informix’, ‘kognitiowx2’, ‘kyvos_mdx’, ‘mapd’, ‘marketo’, ‘mark_logic’, ‘mem_sql’, ‘metamatrix’, ‘microsoft_as’, ‘mongo_db’, ‘my_sql’, ‘neoview’, ‘netezza’, ‘open_access’, ‘oracle’, ‘par_accel’, ‘par_stream’, ‘paypal’, ‘phoenix’, ‘pig’, ‘pivotal_hawq’, ‘postgre_sql’, ‘presto’, ‘red_brick’, ‘salesforce’, ‘sand’, ‘sap’, ‘sap_hana’, ‘sap_hana_mdx’, ‘search_engine’, ‘servicenow’, ‘shopify’, ‘snow_flake’, ‘spark_config’, ‘spark_sql’, ‘splunk’, ‘sql_server’, ‘square’, ‘sybase’, ‘sybase_iq’, ‘sybase_sql_any’, ‘tandem’, ‘teradata’, ‘tm1’, ‘twitter’, ‘unknown’, ‘url_auth’, ‘vectorwise’, ‘vertica’, ‘xquery’]

  • project – id (str) of a project or instance of an Project class to search for the datasource instances in. When provided, both ids and database_types are ignored. By default None.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘date_created’, ‘date_modified’, ‘acg’, ‘datasource_type’, ‘table_prefix’, ‘odbc_version’, ‘intermediate_store_db_name’, ‘intermediate_store_table_space_name’, ‘dbms’, ‘owner’, ‘hidden’, ‘datasource_connection’, ‘database_type’, ‘database_version’, ‘primary_datasource’, ‘data_mart_datasource’]

Examples

>>> list_datasource_instances(connection, name='ds_instance_name')

mstrio.datasources.datasource_login module

class mstrio.datasources.datasource_login.DatasourceLogin(connection: Connection, name: str = None, id: str = None)

Bases: Entity, CopyMixin, DeleteMixin, TranslationMixin

A user login configuration object to access a particular datasource. Also formerly known as database login.

name

name of the database login

id

database login ID

description

Description of the database login

username

database user to be used by the database login

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, DateTime object

date_modified

Last modification time, DateTime object

owner

User object that is the owner

acg

Access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

Object access control list

alter(name: str = None, username: str = None, description: str = None, password: str = None, comments: str | None = None) None

Alter the datasource login properties.

Parameters:
  • name – login object name

  • username – username

  • description – login object description

  • password – database password to be used by the database login

  • comments – long description of the login object

classmethod create(connection: Connection, name: str, username: str, password: str, description: str = None) DatasourceLogin

Create a new datasource login.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • name – login object name

  • username – username

  • description – login object description

  • password – database password to be used by the database login

Returns:

DatasourceConnection object.

mstrio.datasources.datasource_login.list_datasource_logins(connection: Connection, to_dictionary: bool = False, limit: int = None, **filters) list['DatasourceLogin'] | list[dict]

Get list of DatasourceLogin objects or dicts. Optionally filter the logins by specifying filters.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • to_dictionary – If True returns dict, by default (False) returns User 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’, ‘username’]

Examples

>>> list_db_logins(connection, name='db_login_name')

mstrio.datasources.datasource_map module

class mstrio.datasources.datasource_map.DatasourceMap(connection: Connection, id: str | None = None, project: mstrio.server.project.Project | str | None = None, default_connection_map: bool = False, ds_connection: mstrio.datasources.datasource_connection.DatasourceConnection | None = None, datasource: mstrio.datasources.datasource_instance.DatasourceInstance | None = None, user: mstrio.users_and_groups.user.User | mstrio.users_and_groups.user_group.UserGroup | None = None, login: mstrio.datasources.datasource_login.DatasourceLogin | None = None, locale: mstrio.server.language.Language | None = None)

Bases: EntityBase, DeleteMixin

Object representation of MicroStrategy Connection Mapping

The connection mapping provides mapping between a user or a user group and a datasource login for the given datasource and datasource connection.

connection

A MicroStrategy connection object

id

ID of connection mapping.

project

The project the mapping is assigned to.

default_connection_map

Whether the mapping is the default for the project.

ds_connection

The mapped Datasource Connection

datasource

The mapped Datasource Instance

user

The mapped User or UserGroup

login

The mapped Datasource Login

locale

The mapping’s locale. When empty, it’s equivalent to ‘default’ in Workstation and means that default locale for the environment will be used.

alter(user: mstrio.users_and_groups.user.User | mstrio.users_and_groups.user_group.UserGroup | str | None = None, ds_connection: mstrio.datasources.datasource_connection.DatasourceConnection | str | None = None, datasource: mstrio.datasources.datasource_instance.DatasourceInstance | str | None = None, login: mstrio.datasources.datasource_login.DatasourceLogin | str | None = None, locale: mstrio.server.language.Language | str | None = None)

Replace the connection mapping with a newly created one with field values copied unless new ones are specified.

Parameters:
  • connection – A MicroStrategy connection object

  • user – The User or UserGroup to be mapped

  • ds_connection – The Datasource Connection to be mapped

  • datasource – The Datasource Instance to be mapped

  • login – The Datasource Login to be mapped

  • locale – The locale to be mapped

Returns:

DatasourceMap object

classmethod create(connection: Connection, project: mstrio.server.project.Project | str, user: mstrio.users_and_groups.user.User | mstrio.users_and_groups.user_group.UserGroup | str, ds_connection: mstrio.datasources.datasource_connection.DatasourceConnection | str, datasource: mstrio.datasources.datasource_instance.DatasourceInstance | str, login: mstrio.datasources.datasource_login.DatasourceLogin | str, locale: mstrio.server.language.Language | str | None = None, locale_id: str | None = None, locale_name: str | None = None) DatasourceMap

Create a new connection mapping on the server. If more than one locale related parameters are provided, locale has priority, then locale_id.

Parameters:
  • connection – A MicroStrategy connection object

  • project – The project the mapping is to be assigned to

  • user – The User or UserGroup to be mapped

  • ds_connection – The Datasource Connection to be mapped

  • datasource – The Datasource Instance to be mapped

  • login – The Datasource Login to be mapped

  • locale – The locale to be mapped.

  • locale_id – The id of locale to be mapped.

  • locale_name – The name of locale to be mapped.

Returns:

DatasourceMap object

classmethod from_dict(source: dict[str, Any], connection: Connection, to_snake_case: bool = True) DatasourceMap
Overrides Dictable.from_dict() to instantiate an object from

a dictionary without calling any additional getters.

Parameters:
  • cls (T) – Class (type) of an object that should be created.

  • source (dict[str, Any]) – a dictionary from which an object will be constructed.

  • connection (Connection) – A MicroStrategy Connection object.

  • to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case, default True.

  • with_missing_value – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.

Returns:

An object of type T.

Return type:

T

to_dict(camel_case=True)

Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.

Parameters:

camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.

Returns:

A dictionary representation of object’s attributes and values.

By default, the dictionary keys are in camel case.

Return type:

dict

mstrio.datasources.datasource_map.list_datasource_mappings(connection: Connection, project: mstrio.server.project.Project | str | None = None, to_dictionary: bool = False, limit: int | None = None, user: mstrio.users_and_groups.user.User | mstrio.users_and_groups.user_group.UserGroup | str | None = None, ds_connection: mstrio.datasources.datasource_connection.DatasourceConnection | str | None = None, datasource: mstrio.datasources.datasource_instance.DatasourceInstance | str | None = None, login: mstrio.datasources.datasource_login.DatasourceLogin | str | None = None, locale: mstrio.server.language.Language | str | None = None, default_connection_map: bool = False) list[mstrio.datasources.datasource_map.DatasourceMap] | list[dict]

Get list of connection mappings: objects or dicts. Optionally filter by specifying filters. When returned as dictionaries, connection mappings that have default locale

will have ‘locale’ property with empty name and id.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • default_connection_map – True if requesting default connection mappings. Default False

  • project – The project (or its id) which mappings are to be fetched. Optional unless requesting the default mappings.

  • to_dictionary – If True returns dict, by default (False) returns DatasourceMap objects.

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • locale – filter list by locale

  • login – filter list by datasource login

  • datasource – filter list by datasource instance

  • ds_connection – filter list by datasource connection

  • user – filter list by user or user group

Returns:

list[‘DatasourceMap’] by default list[dict] if to_dictionary is True

Examples

>>> list_datasource_mappings(connection)

mstrio.datasources.dbms module

class mstrio.datasources.dbms.Dbms(connection: Connection, name: str = None, id: str = None)

Bases: EntityBase

Object representation of MicroStrategy Database management system (DBMS)

name

Database management system (DBMS) name.

id

Database management system (DBMS) ID.

mstrio.datasources.dbms.list_available_dbms(connection: Connection, to_dictionary: bool = False, limit: int = None, **filters) list['Dbms'] | list[dict]

List all available database management systems (DBMSs) objects or dicts. Optionally filter the DBMS by specifying filters.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • to_dictionary – If True returns dict, by default (False) returns User objects.

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘type’, ‘version’]

Examples

>>> list_available_dbms(connection)

mstrio.datasources.driver module

class mstrio.datasources.driver.Driver(connection: Connection, id: str | None = None, name: str | None = None)

Bases: Entity, TranslationMixin

Object representation of Microstrategy Driver

connection

A MicroStrategy connection object

id

Driver’s ID

name

Driver’s name

is_enabled

specifies if a Driver is enabled

is_odbc

specifies if a Driver is of ODBC type

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

User object that is the owner

icon_path

Object icon path

view_media

View media settings

ancestors

List of ancestor folders

certified_info

Certification status, time of certification, and information about the certifier (currently only for document and report)

acg

Access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

Object access control list

alter(is_enabled: bool | None = None, comments: str | None = None)

Update properties of a Driver

Parameters:
  • is_enabled (bool, optional) – specifies if a Driver is enabled

  • comments – long description of the Driver

disable()

Disable driver.

enable()

Enable driver.

classmethod list(connection: Connection, to_dictionary: bool = False, **filters) list[type[mstrio.datasources.driver.Driver]] | list[dict]

Get all driver as list of Driver objects or dictionaries.

Optionally filter the drivers by specifying filters.

Parameters:
  • connection (Connection) – MicroStrategy connection object

  • to_dictionary – If True returns a list of Driver dicts, otherwise returns a list of Driver objects

mstrio.datasources.driver.list_drivers(connection: Connection, to_dictionary: bool = False, **filters) list[mstrio.datasources.driver.Driver] | list[dict]

Get all drivers as list of Driver objects or dictionaries.

Optionally filter the drivers by specifying filters.

Parameters:
  • connection – MicroStrategy connection object

  • to_dictionary

    If True returns a list of Driver dicts,

    otherwise returns a list of Driver objects

    **filters: Available filter parameters:

    [‘id’, ‘name’, ‘is_enabled’, ‘is_odbc’]

mstrio.datasources.embedded_connection module

class mstrio.datasources.embedded_connection.EmbeddedConnection(connection: Connection, datasource_id: str)

Bases: EntityBase

Datasource connection configuration object that represents an embedded connection template for the datasource.

connection

A MicroStrategy connection object.

id

Unique datasource connection ID.

name

Unique datasource connection name.

datasource_id

ID of the corresponding datasource instance.

description

Datasource connection description.

execution_mode

ExecutionMode Enum specifying how SQL statements will be executed on a physical database connection made.

max_cancel_attempt_time

Number of seconds before being timed out when attempting to make a connection.

max_query_exe_time

Number of seconds during which a query must be executed before being timed out.

max_connection_attempt_time

Number of seconds connection attempts to be made before timing out.

connection_lifetime

Number of seconds of the connection lifetime.

connection_idle_timeout

Number of seconds before being timed out when the connection is idle.

char_encoding_windows

CharEncoding Enum specifying the encoding across connection for Windows drivers.

char_encoding_unix

CharEncoding Enum specifying the encoding across connection for Unix drivers.

table_prefix

String prefixed to the names of all temporary tables created by the Query Engine for this connection during report execution with this string.

connection_string

Database connection string.

parameterized_queries

Specifies whether parameterized queries are enabled.

extended_fetch

Specifies whether or not to use the extended fetch ODBC call to retrieve data from the database connection.

datasource_login

DatasourceLogin object or ID

database_type

Database type

database_version

Database version

driver_type

DriverType Enum specifying Driver used for database connection.

oauth_parameter

Used for authentication with oAuth.

type

Object type

subtype

Object subtype

date_created

Creation time, DateTime object

date_modified

Last modification time, DateTime object

owner

User object that is the owner

acg

Object access rights. It a bit vector where bits are defined at [EnumDSSXMLAccessRightFlags].

acl

Object access control list

iam

List of projects to which the fence is applied.

resource

The url of configured Web API for OAuth authentication usage.

scope

List of delegated permissions that the app is requesting.

enable_sso

Specifies whether to use Single Sign-On.

alter(description: str | None = None, execution_mode: str | mstrio.datasources.helpers.ExecutionMode | None = None, max_cancel_attempt_time: int | None = None, max_query_exe_time: int | None = None, max_connection_attempt_time: int | None = None, connection_lifetime: int | None = None, connection_idle_timeout: int | None = None, char_encoding_windows: str | mstrio.datasources.helpers.CharEncoding | None = None, char_encoding_unix: str | mstrio.datasources.helpers.CharEncoding | None = None, table_prefix: str | None = None, connection_string: str | None = None, parameterized_queries: bool | None = None, extended_fetch: bool | None = None, driver_type: str | mstrio.datasources.helpers.DriverType | None = None, oauth_parameter: str | None = None, resource: str | None = None, scope: str | None = None, enable_sso: bool | None = None, comments: str | None = None) None

Alter the datasource connection properties.

Parameters:
  • description – Datasource connection description.

  • execution_mode – ExecutionMode Enum specifying how SQL statements will be executed on a physical database connection made.

  • max_cancel_attempt_time – Number of seconds before being timed out when attempting to make a connection.

  • max_query_exe_time – Number of seconds during which a query must be executed before being timed out.

  • max_connection_attempt_time – Number of seconds connection attempts to be made before timing out.

  • connection_lifetime – Number of seconds of the connection lifetime.

  • connection_idle_timeout – Number of seconds before being timed out when the connection is idle.

  • char_encoding_windows – CharEncoding Enum specifying the encoding across connection for Windows drivers.

  • char_encoding_unix – CharEncoding Enum specifying the encoding across connection for Unix drivers.

  • table_prefix – String prefixed to the names of all temporary tables created by the Query Engine for this connection during report execution with this string.

  • connection_string – Database connection string.

  • parameterized_queries – Specifies whether parameterized queries are enabled.

  • extended_fetch – Specifies whether or not to use the extended fetch ODBC call to retrieve data from the database connection.

  • driver_type – DriverType Enum specifying Driver used for database connection.

  • datasource_loginDatasourceLogin object or ID

  • driver_type – ENUM Drivers used for database connection.

  • database_type – Database type

  • database_version – Database version

  • resource – The url of configured Web API for OAuth authentication usage.

  • scope – List of delegated permissions that the app is requesting.

  • enable_sso – Specifies whether to use Single Sign-On.

mstrio.datasources.gateway module

class mstrio.datasources.gateway.Gateway(connection: Connection, id: str | None = None, name: str | None = None)

Bases: EntityBase

Object representation of Microstrategy Gateway

id

Gateway’s ID

name

Gateway’s name

gateway_type

Gateway’s type

db_type

Database type

is_certified

Specifies if a gateway is certified

classmethod list(connection: Connection, to_dictionary: bool = False, **filters) list[type[mstrio.datasources.gateway.Gateway]] | list[dict]

Get all gateways as list of Gateway objects or dictionaries.

Optionally filter the gateways by specifying filters.

Parameters:
  • connection (Connection) – MicroStrategy connection object

  • to_dictionary – If True returns a list of Gateway dicts, otherwise returns a list of Gateway objects

mstrio.datasources.gateway.list_gateways(connection: Connection, to_dictionary: bool = False, **filters) list[mstrio.datasources.gateway.Gateway] | list[dict]

Get all gateways as list of Gateway objects or dictionaries.

Optionally filter the gateways by specifying filters.

Parameters:
  • connection (Connection) – MicroStrategy connection object

  • to_dictionary – If True returns a list of Gateway dicts, otherwise returns a list of Gateway objects

mstrio.datasources.helpers module

class mstrio.datasources.helpers.CharEncoding(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

NON_UTF8 = 'multibyte'
UTF8 = 'utf8'
class mstrio.datasources.helpers.DBType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

Enumeration representing database type.

ACCESS = 'access'
ALTIBASE = 'altibase'
AMAZON_ATHENA = 'amazon_athena'
AMAZON_AURORA = 'amazon_aurora'
AMAZON_DOCUMENT_DB = 'amazon_document_db'
AMAZON_DYNAMO_DB = 'amazon_dynamo_db'
AMAZON_REDSHIFT = 'amazon_redshift'
ARCADIA_PLATFORM = 'arcadia_platform'
ASTER = 'aster'
AZURE_COSMOS = 'azure_cosmos'
BIG_DATA_ENGINE = 'big_data_engine'
CASSANDRA = 'cassandra'
CIRRO = 'cirro'
CLOUD_ELEMENT = 'cloud_element'
CLOUD_GATEWAY = 'cloud_gateway'
CLOUD_GATEWAY_AWS_S3 = 'cloud_gateway_aws_s3'
CLOUD_GATEWAY_AZURE_ADLS_2 = 'cloud_gateway_azure_adls_2'
CLOUD_GATEWAY_GOOGLE_CLOUD_STORAGE = 'cloud_gateway_google_cloud_storage'
CLOUD_GATEWAY_SHAREPOINT = 'cloud_gateway_sharepoint'
COMPOSITE = 'composite'
CONCUR = 'concur'
CONNECTION_CLOUD = 'connection_cloud'
DATABRICKS = 'databricks'
DATALLEGRO = 'datallegro'
DATA_DIRECT_CLOUD = 'data_direct_cloud'
DB2 = 'db2'
DENODO = 'denodo'
DREMIO = 'dremio'
DRILL = 'drill'
DROPBOX = 'dropbox'
DRUID = 'druid'
ELASTICSEARCH = 'elasticsearch'
ELOQUA = 'eloqua'
ENTERPRISE_DB = 'enterprise_db'
ESS_BASE = 'ess_base'
EXA_SOLUTION = 'exa_solution'
EXCEL = 'excel'
FACEBOOK = 'facebook'
FINANCIALFORCE = 'financialforce'
GBASE_8A = 'gbase_8a'
GENERIC = 'generic'
GENERIC_DATA_CONNECTOR = 'generic_data_connector'
GITHUB = 'github'
GOOGLE_ANALYTICS = 'google_analytics'
GOOGLE_BIG_QUERY = 'google_big_query'
GOOGLE_BIG_QUERY_FF_SQL = 'google_big_query_ff_sql'
GOOGLE_CLOUD_SPANNER = 'google_cloud_spanner'
GOOGLE_DRIVE = 'google_drive'
HIVE = 'hive'
HIVE_THRIFT = 'hive_thrift'
HUBSPOT = 'hubspot'
IBM_IPS = 'ibm_ips'
IMPALA = 'impala'
INFORMATICA = 'informatica'
INFORMIX = 'informix'
JIRA = 'jira'
KAFKA = 'kafka'
KOGNITIOWX2 = 'kognitiowx2'
KYVOS_MDX = 'kyvos_mdx'
MAPD = 'mapd'
MARKETO = 'marketo'
MARK_LOGIC = 'mark_logic'
MEM_SQL = 'mem_sql'
METAMATRIX = 'metamatrix'
MICROSOFT_AS = 'microsoft_as'
MICROSOFT_DYNAMICS_365 = 'microsoft_dynamics_365'
MICROSOFT_DYNAMICS_CRM = 'microsoft_dynamics_crm'
MICROSOFT_DYNAMICS_ERP = 'microsoft_dynamics_erp'
MICROSOFT_FABRIC = 'microsoft_fabric'
MONGO_BI = 'mongo_bi'
MONGO_DB = 'mongo_db'
MY_SQL = 'my_sql'
NEO4J = 'neo4j'
NEOVIEW = 'neoview'
NETEZZA = 'netezza'
ODATA = 'odata'
OPEN_ACCESS = 'open_access'
ORACLE = 'oracle'
ORACLE_CX_SALES = 'oracle_cx_sales'
ORACLE_CX_SERVICE = 'oracle_cx_service'
ORACLE_ELOQUA = 'oracle_eloqua'
PALANTIR_FOUNDRY = 'palantir_foundry'
PAR_ACCEL = 'par_accel'
PAR_STREAM = 'par_stream'
PAYPAL = 'paypal'
PHOENIX = 'phoenix'
PIG = 'pig'
PIVOTAL_HAWQ = 'pivotal_hawq'
POSTGRE_SQL = 'postgre_sql'
PRESTO = 'presto'
PYTHON = 'python'
RED_BRICK = 'red_brick'
RESERVED = 'reserved'
SALESFORCE = 'salesforce'
SAND = 'sand'
SAP = 'sap'
SAP_BW4_HANA = 'sap_bw4_hana'
SAP_BW_ODATA = 'sap_bw_odata'
SAP_ECC_ODATA = 'sap_ecc_odata'
SAP_HANA = 'sap_hana'
SAP_HANA_MDX = 'sap_hana_mdx'
SAP_S4_HANA = 'sap_s4_hana'
SEARCH_ENGINE = 'search_engine'
SERVICEMAX = 'servicemax'
SERVICENOW = 'servicenow'
SHOPIFY = 'shopify'
SNOW_FLAKE = 'snow_flake'
SPARK_CONFIG = 'spark_config'
SPARK_SQL = 'spark_sql'
SPLUNK = 'splunk'
SQL_SERVER = 'sql_server'
SQUARE = 'square'
STARBURST = 'starburst'
SUGAR_CRM = 'sugar_crm'
SYBASE = 'sybase'
SYBASE_IQ = 'sybase_iq'
SYBASE_SQL_ANY = 'sybase_sql_any'
TANDEM = 'tandem'
TEAMCITY = 'teamcity'
TERADATA = 'teradata'
TM1 = 'tm1'
TRINO = 'trino'
TWITTER = 'twitter'
UNKNOWN = 'unknown'
URL_AUTH = 'url_auth'
VECTORWISE = 'vectorwise'
VERTICA = 'vertica'
XQUERY = 'xquery'
YELLOWBRICK = 'yellowbrick'
class mstrio.datasources.helpers.DriverType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

NATIVE = 'native'
ODBC = 'odbc'
RESERVED = 'reserved'
class mstrio.datasources.helpers.ExecutionMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

ASYNC_CONNECTION = 'async_connection'
ASYNC_STATEMENT = 'async_statement'
RESERVED = 'reserved'
SYNCHRONOUS = 'synchronous'
class mstrio.datasources.helpers.GatewayType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoCapitalizedName

Enumeration representing gateway type.

CLOUD = 'Cloud'
COMMUNITY = 'Community'
NATIVE = 'Native'
RELATIONAL = 'Relational'

Module contents