mstrio.modeling.schema package¶
Subpackages¶
Submodules¶
mstrio.modeling.schema.helpers module¶
- class mstrio.modeling.schema.helpers.AttributeDisplays(report_displays: list[mstrio.modeling.schema.helpers.FormReference], browse_displays: list[mstrio.modeling.schema.helpers.FormReference])¶
Bases:
Dictable
The collections of report displays and browse displays of the attribute.
- report_displays¶
list of an AttributeSorts for report displays
- browse_displays¶
list of an AttributeSorts for browse displays
- class mstrio.modeling.schema.helpers.AttributeSort(form: FormReference, ascending: bool = False)¶
Bases:
Dictable
An individual sort element in an AttributeSorts list.
- form¶
A form reference
- ascending¶
whether the sort is in ascending or descending order
- class mstrio.modeling.schema.helpers.AttributeSorts(report_sorts: list[mstrio.modeling.schema.helpers.AttributeSort] | None = None, browse_sorts: list[mstrio.modeling.schema.helpers.AttributeSort] | None = None)¶
Bases:
Dictable
The collections of report sorts and browse sorts of the attribute.
- report_sorts¶
list of an AttributeSorts for report sorts
- browse_sorts¶
list of an AttributeSorts for browse sorts
- class mstrio.modeling.schema.helpers.DataType(type: Type, precision: str, scale: str)¶
Bases:
Dictable
Representation in the object model for a data-type that could be used for a SQL column.
- type¶
gross data type of an actual or proposed column in a database.
- precision¶
for relevant data types, the length of the representation
- scale¶
for relevant data types, the fixed position used
- in the representation
- class Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
String literal used to identify the gross data type of an actual or proposed column in a database.
- BINARY = 'binary'¶
- BOOL = 'bool'¶
- CELL_FORMAT_DATA = 'cell_format_data'¶
- CHAR = 'char'¶
- DATE = 'date'¶
- DECIMAL = 'decimal'¶
- DOUBLE_DOUBLE = 'double_double'¶
- FIXED_LENGTH_STRING = 'fixed_length_string'¶
- FLOAT = 'float'¶
- GUID = 'guid'¶
- INT64 = 'int64'¶
- INTEGER = 'integer'¶
- LONG = 'long'¶
- LONGVARBIN = 'longvarbin'¶
- MB_CHAR = 'mb_char'¶
- MISSING = 'missing'¶
- NUMERIC = 'numeric'¶
- N_CHAR = 'n_char'¶
- N_PATTERN = 'n_pattern'¶
- N_VAR_CHAR = 'n_var_char'¶
- PATTERN = 'pattern'¶
- REAL = 'real'¶
- RESERVED = 'reserved'¶
- SHORT = 'short'¶
- TIME = 'time'¶
- TIME_STAMP = 'time_stamp'¶
- UNKNOWN = 'unknown'¶
- UNSIGNED = 'unsigned'¶
- UTF8_CHAR = 'utf8_char'¶
- VARIABLE_LENGTH_STRING = 'variable_length_string'¶
- VAR_BIN = 'var_bin'¶
- class mstrio.modeling.schema.helpers.FormReference(id: str = None, name: str = None)¶
Bases:
Dictable
The reference that identifies a form object within the context of a given attribute. When writing back an attribute, either id or name is needed to identify a form, and if both are provided, id will take the higher priority.
- id¶
id of the form
- name¶
name of the form
- class mstrio.modeling.schema.helpers.ObjectSubType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
String literal used to identify the type of a metadata object. Some MicroStrategy APIs make a distinction between an object’s type and subtype because in some cases (e.g. the different kinds of reports) it can be useful to see one “report” concept rather than to have to always distinguish between different kinds of reports. But there are cases (e.g. filters versus custom-groups or users versus user-groups ) where users want to see the different subtypes of the same type as fundamentally different. Used across different modeling modules e.g. attributes, user hierarchies.
- AGG_METRIC = 'agg_metric'¶
- ATTRIBUTE = 'attribute'¶
- ATTRIBUTE_ABSTRACT = 'attribute_abstract'¶
- ATTRIBUTE_DERIVED = 'attribute_derived'¶
- ATTRIBUTE_FORM_CUSTOM = 'attribute_form_custom'¶
- ATTRIBUTE_FORM_NORMAL = 'attribute_form_normal'¶
- ATTRIBUTE_FORM_SYSTEM = 'attribute_form_system'¶
- ATTRIBUTE_RECURSIVE = 'attribute_recursive'¶
- ATTRIBUTE_ROLE = 'attribute_role'¶
- ATTRIBUTE_TRANSFORMATION = 'attribute_transformation'¶
- BLOB_EXCEL = 'blob_excel'¶
- BLOB_HTML_TEMPLATE = 'blob_html_template'¶
- BLOB_IMAGE = 'blob_image'¶
- BLOB_OTHER = 'blob_other'¶
- BLOB_PROJECT_PACKAGE = 'blob_project_package'¶
- BLOB_UNKNOWN = 'blob_unknown'¶
- CALENDAR_SYSTEM = 'calendar_system'¶
- CATALOG = 'catalog'¶
- CATALOG_DEFN = 'catalog_defn'¶
- CHANGE_JOURNAL = 'change_journal'¶
- CHANGE_JOURNAL_SEARCH = 'change_journal_search'¶
- COLUMN = 'column'¶
- COLUMN_CUSTOM = 'column_custom'¶
- COLUMN_NORMAL = 'column_normal'¶
- CONFIGURATION = 'configuration'¶
- CONSOLIDATION = 'consolidation'¶
- CONSOLIDATION_DERIVED = 'consolidation_derived'¶
- CONSOLIDATION_ELEMENT = 'consolidation_element'¶
- CUSTOM_GROUP = 'custom_group'¶
- DASHBOARD = 'dossier'¶
- DASHBOARD_TEMPLATE = 'dashboard_template'¶
- DATAMART = 'datamart'¶
- DATAMART_REPORT = 'datamart_report'¶
- DBMS = 'dbms'¶
- DB_CONNECTION = 'db_connection'¶
- DB_LOGIN = 'db_login'¶
- DB_ROLE = 'db_role'¶
- DB_ROLE_CLOUD_ELEMENT = 'db_role_cloud_element'¶
- DB_ROLE_DATA_IMPORT_SERVER = 'db_role_data_import_server'¶
- DB_ROLE_GENERIC_DATA_CONNECTOR = 'db_role_generic_data_connector'¶
- DB_ROLE_IMPORT = 'db_role_import'¶
- DB_ROLE_IMPORT_PRIMARY = 'db_role_import_primary'¶
- DB_ROLE_O_AUTH = 'db_role_o_auth'¶
- DB_ROLE_REMOTE_DATE_SOURCE = 'db_role_remote_date_source'¶
- DB_ROLE_URL_AUTH = 'db_role_url_auth'¶
- DB_TABLE_PMT = 'db_table_pmt'¶
- DB_TABLE_SOURCE = 'db_table_source'¶
- DEVICE = 'device'¶
- DIMENSION_ORDERED = 'dimension_ordered'¶
- DIMENSION_SYSTEM = 'dimension_system'¶
- DIMENSION_USER = 'dimension_user'¶
- DIMENSION_USER_HIERARCHY = 'dimension_user_hierarchy'¶
- DOCUMENT_DEFINITION = 'document_definition'¶
- DOCUMENT_THEME = 'document_theme'¶
- DOSSIER = 'dossier'¶
- DRILL_MAP = 'drill_map'¶
- EXTERNAL_SHORTCUT_SNAPSHOT = 'external_shortcut_snapshot'¶
- EXTERNAL_SHORTCUT_TARGET = 'external_shortcut_target'¶
- EXTERNAL_SHORTCUT_UNKNOWN = 'external_shortcut_unknown'¶
- EXTERNAL_SHORTCUT_URL = 'external_shortcut_url'¶
- FACT = 'fact'¶
- FACT_GROUP = 'fact_group'¶
- FILTER = 'filter'¶
- FILTER_PARTITION = 'filter_partition'¶
- FLAG = 'flag'¶
- FOLDER = 'folder'¶
- FOLDER_SYSTEM = 'folder_system'¶
- FORMAT = 'format'¶
- FUNCTION = 'function'¶
- FUNCTION_PACKAGE_DEFINITION = 'function_package_definition'¶
- FUNCTION_THIRD_PARTY = 'function_third_party'¶
- GRAPH_STYLE = 'graph_style'¶
- INDEXED_SEARCH = 'indexed_search'¶
- LINK = 'link'¶
- LOCALE = 'locale'¶
- LOGICAL_TABLE = 'logical_table'¶
- MD_SECURITY_FILTER = 'md_security_filter'¶
- METRIC = 'metric'¶
- METRIC_DMX = 'metric_dmx'¶
- METRIC_EXTREME = 'metric_extreme'¶
- METRIC_REFERENCE_LINE = 'metric_reference_line'¶
- METRIC_RELATIONSHIP = 'metric_relationship'¶
- METRIC_SUBTOTAL = 'metric_subtotal'¶
- METRIC_TRAINING = 'metric_training'¶
- MONITOR_DB_CONNECTIONS = 'monitor_db_connections'¶
- MONITOR_JOBS = 'monitor_jobs'¶
- MONITOR_PERFORMANCE = 'monitor_performance'¶
- MONITOR_USER_CONNECTIONS = 'monitor_user_connections'¶
- PALETTE_CUSTOM = 'palette_custom'¶
- PALETTE_SYSTEM = 'palette_system'¶
- PHYSICAL_TABLE = 'physical_table'¶
- PROJECT = 'project'¶
- PROMPT = 'prompt'¶
- PROMPT_ANSWER = 'prompt_answer'¶
- PROMPT_ANSWERS = 'prompt_answers'¶
- PROMPT_ANSWER_BIG_DECIMAL = 'prompt_answer_big_decimal'¶
- PROMPT_ANSWER_BOOLEAN = 'prompt_answer_boolean'¶
- PROMPT_ANSWER_DATE = 'prompt_answer_date'¶
- PROMPT_ANSWER_DIMTY = 'prompt_answer_dimty'¶
- PROMPT_ANSWER_DOUBLE = 'prompt_answer_double'¶
- PROMPT_ANSWER_ELEMENTS = 'prompt_answer_elements'¶
- PROMPT_ANSWER_EXPRESSION = 'prompt_answer_expression'¶
- PROMPT_ANSWER_EXPRESSION_DRAFT = 'prompt_answer_expression_draft'¶
- PROMPT_ANSWER_INT64 = 'prompt_answer_int64'¶
- PROMPT_ANSWER_LONG = 'prompt_answer_long'¶
- PROMPT_ANSWER_OBJECTS = 'prompt_answer_objects'¶
- PROMPT_ANSWER_STRING = 'prompt_answer_string'¶
- PROMPT_BIG_DECIMAL = 'prompt_big_decimal'¶
- PROMPT_BOOLEAN = 'prompt_boolean'¶
- PROMPT_DATE = 'prompt_date'¶
- PROMPT_DIMTY = 'prompt_dimty'¶
- PROMPT_DOUBLE = 'prompt_double'¶
- PROMPT_ELEMENTS = 'prompt_elements'¶
- PROMPT_EXPRESSION = 'prompt_expression'¶
- PROMPT_EXPRESSION_DRAFT = 'prompt_expression_draft'¶
- PROMPT_LONG = 'prompt_long'¶
- PROMPT_OBJECTS = 'prompt_objects'¶
- PROMPT_STRING = 'prompt_string'¶
- PROPERTY_GROUP = 'property_group'¶
- PROPERTY_SET = 'property_set'¶
- RECONCILIATION = 'reconciliation'¶
- RELATIONSHIP_SEARCH = 'relationship_search'¶
- REPORT_BASE = 'report_base'¶
- REPORT_CUBE = 'report_cube'¶
- REPORT_DATAMART = 'report_datamart'¶
- REPORT_EMMA_CUBE = 'report_emma_cube'¶
- REPORT_EMMA_CUBE_IRR = 'report_emma_cube_irr'¶
- REPORT_ENGINE = 'report_engine'¶
- REPORT_GRAPH = 'report_graph'¶
- REPORT_GRID = 'report_grid'¶
- REPORT_GRID_AND_GRAPH = 'report_grid_and_graph'¶
- REPORT_HYPER_CARD = 'report_hyper_card'¶
- REPORT_INCREMENT_REFRESH = 'report_increment_refresh'¶
- REPORT_NON_INTERACTIVE = 'report_non_interactive'¶
- REPORT_TEXT = 'report_text'¶
- REPORT_TRANSACTION = 'report_transaction'¶
- REPORT_WRITING_DOCUMENT = 'report_writing_document'¶
- REQUEST = 'request'¶
- RESOLUTION = 'resolution'¶
- ROLE = 'role'¶
- ROLE_TRANSFORMATION = 'role_transformation'¶
- SCHEDULE_EVENT = 'schedule_event'¶
- SCHEDULE_OBJECT = 'schedule_object'¶
- SCHEDULE_TRIGGER = 'schedule_trigger'¶
- SCHEMA = 'schema'¶
- SEARCH = 'search'¶
- SEARCH_FOLDER = 'search_folder'¶
- SEARCH_FOLDER_CROSS_PROJECT = 'search_folder_cross_project'¶
- SECURITY_ROLE = 'security_role'¶
- SEGMENT = 'segment'¶
- SERVER_DEF = 'server_def'¶
- SHORTCUT = 'shortcut'¶
- SHORTCUT_WEAK_REF = 'shortcut_weak_ref'¶
- STYLE = 'style'¶
- SUBSCRIPTION_ADDRESS = 'subscription_address'¶
- SUBSCRIPTION_CONTACT = 'subscription_contact'¶
- SUBSCRIPTION_INSTANCE = 'subscription_instance'¶
- SYSTEM_SUBTOTAL = 'system_subtotal'¶
- TABLE_PARTITION_MD = 'table_partition_md'¶
- TABLE_PARTITION_WH = 'table_partition_wh'¶
- TEMPLATE = 'template'¶
- THRESHOLDS = 'thresholds'¶
- TIMEZONE_SYSTEM = 'timezone_system'¶
- TRANSMITTER = 'transmitter'¶
- USER = 'user'¶
- USER_GROUP = 'user_group'¶
- class mstrio.modeling.schema.helpers.PhysicalTableType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- NORMAL = 'normal'¶
- RESERVED = 'reserved'¶
- SQL = 'sql'¶
- WAREHOUSE_PARTITION = 'warehouse_partition'¶
- class mstrio.modeling.schema.helpers.SchemaObjectReference(sub_type: ObjectSubType, object_id: str | None = None, name: str | None = None, is_embedded: bool | None = None)¶
Bases:
Dictable
Information about an object referenced within the specification of another object. An object reference typically contains only enough fields to uniquely identify the referenced objects.
- object_id¶
object’s id, a globally unique identifier used to distinguish between metadata objects within the same project
- Type:
str | None
- sub_type¶
string literal used to identify the type of a metadata object
- name¶
the name of the metadata object
- Type:
str | None
- is_embedded¶
if true indicates that the target object of this reference is embedded within this object, bool
- Type:
bool | None
- classmethod create_from(schema_object: Attribute | UserHierarchy, is_embedded: bool = None) SchemaObjectReference ¶
Converts a schema object into a schema object reference
- Parameters:
schema_object – a schema object
is_embeded – a boolean indicating whether the schema object is embedded or not
- Returns:
SchemaObjectReference of the given schema object
- is_embedded: bool | None = None¶
- name: str | None = None¶
- object_id: str | None = None¶
- sub_type: ObjectSubType¶
- to_object(connection: Connection) Attribute | UserHierarchy ¶
Converts a schema object reference into a schema object.
- Parameters:
connection – a connection object required to fetch the schema object
- class mstrio.modeling.schema.helpers.TableColumn(data_type: DataType, column_name: str | None = None, name: str | None = None, id: str | None = None, sub_type: mstrio.modeling.schema.helpers.ObjectSubType | None = None, date_created: str | None = None, date_modified: str | None = None, version_id: str | None = None, primary_locale: str | None = None)¶
Bases:
Dictable
An object representation of a physical column that might appear in some data source. In addition to representing physical columns, we also use this object to represent columns that do not actually appear in any data source but which the engine should create if it needs to make a column to contain data for some higher level construct (e.g. a fact, an attribute form etc.).
- column_name: str | None = None¶
- date_created: str | None = None¶
- date_modified: str | None = None¶
- classmethod from_dict(source: dict[str, Any], connection: Connection | None = None, to_snake_case: bool = True, with_missing_value: bool = False) TableColumn ¶
Creates an object from a dictionary. The dictionary’s keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in _FROM_DICT_MAP.
- 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, optional) – A MSTR Connection object. Defaults to None.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to 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
- id: str | None = None¶
- name: str | None = None¶
- primary_locale: str | None = None¶
- sub_type: mstrio.modeling.schema.helpers.ObjectSubType | None = None¶
- version_id: str | None = None¶
mstrio.modeling.schema.schema_management module¶
- class mstrio.modeling.schema.schema_management.SchemaLockStatus(lock_type: Union[SchemaLockType, str], date_created: str | None = None, comment: str | None = None, machine_name: str | None = None, owner_name: str | None = None, owner_id: str | None = None)¶
Bases:
Dictable
An object that contains all of the information about the lock status of the schema. If the schema is not locked then properties of the lock are not provided.
- class mstrio.modeling.schema.schema_management.SchemaLockType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
Enumeration constants used to specify a type of lock that can be placed on schema. Type UNLOCKED is used only when displaying status.
- ABSOLUTE_CONSTITUENT = 'absolute_constituent'¶
- ABSOLUTE_INDIVIDUAL = 'absolute_individual'¶
- EXCLUSIVE_CONSTITUENT = 'exclusive_constituent'¶
- UNLOCKED = 'none'¶
- class mstrio.modeling.schema.schema_management.SchemaManagement(connection: Connection, project_id: str | None = None, project_name: str | None = None)¶
Bases:
object
Representation of schema management object.
- connection¶
instance of Connection object
- lock_type¶
type of lock which is placed on the schema
- project_id¶
ID of project on which schema is managed
- project_name¶
Project name
- tasks¶
array with objects of type SchemaTask. It represents tasks which were created for the current object of SchemaManagement. They are created when schema is reloaded asynchronously.
- get_lock_status() SchemaLockStatus ¶
Get the lock status of the schema.
- Returns:
Lock status of the schema as SchemaLockStatus object.
- get_task(task_index: int) SchemaTask ¶
Get all details of the task which is stored at a given task_index in a list from property tasks.
- Parameters:
task_index (int) – Index of the task in the list stored in property tasks.
- Returns:
SchemaTask object with all details about the task from the given index. When index is not proper then None is returned and warning with explanation message is shown.
- lock(lock_type: Union[str, SchemaLockType]) bool ¶
Lock the schema. After successfully locking the schema its lock_type property is updated.
- Parameters:
lock_type – (string or object): Type of lock which will be placed on the schema.
- Returns:
True when schema was successfully locked or schema has already been locked. False when procedure of locking schema failed.
- Raises:
TypeError –
a SchemaLockType. –
ValueError –
a proper value of enum SchemaLockType. –
- reload(update_types: Optional[Union[list[Union[str, mstrio.modeling.schema.schema_management.SchemaUpdateType]], str, SchemaUpdateType]] = None, respond_async: bool = True) Optional[SchemaTask] ¶
Reload (update) the schema. This operation can be performed asynchronously. In that case the task is created and it is saved in property tasks to help tracking its status.
- Parameters:
update_types (optional, list or object or string) –
Field with update type(s). Values in this field can be of type string or SchemaUpdateType or be a list of those types. This field can contain empty, any of the following options, or all of them: - table_key: Use this option if you changed the key structure
of a table.
entry_level: Use this option if you changed the level at which a fact is stored.
logical_size: Use this option to recalculate logical table sizes and override any modifications you made to logical table sizes.
clear_element_cache: Use this option to clear up the attribute element cache saved on the Intelligence Server.
respond_async (optional, bool) – When True reload is performed asynchronously. Otherwise it is performed synchronously. Default value is True.
- Returns:
When respond_async is set to True then SchemaTask object with all details about the task of reloading schema is returned. Otherwise None is returned.
- Raises:
TypeError –
a SchemaUpdateType. –
ValueError –
which is not a proper value of enum SchemaUpdateType. –
- unlock() bool ¶
Unlock the schema. After successfully unlocking the schema its lock_type property is updated.
- Returns:
True when schema was successfully unlocked or it has already been unlocked. False when procedure of unlocking schema failed.
- class mstrio.modeling.schema.schema_management.SchemaTask(id: str, status: str | mstrio.modeling.schema.schema_management.SchemaTaskStatus, start_time: str | None = None, end_time: str | None = None, errors: list[mstrio.modeling.schema.schema_management.SchemaTaskError] | None = None)¶
Bases:
Dictable
Detailed information about a task which is performed on the schema.
- class mstrio.modeling.schema.schema_management.SchemaTaskError(code: str, message: str, additional_properties: dict | None = None)¶
Bases:
Dictable
Representation of properties used to report an error related to schema task.
- class mstrio.modeling.schema.schema_management.SchemaTaskStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
Enumeration constants used to specify status of the task.
- COMPLETED = 'completed'¶
- FAILED = 'failed'¶
- RUNNING = 'running'¶
- class mstrio.modeling.schema.schema_management.SchemaUpdateType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
Enumeration constants used to specify type of update for the schema.
- CLEAR_ELEMENT_CACHE = 'clear_element_cache'¶
- ENTRY_LEVEL = 'entry_level'¶
- LOGICAL_SIZE = 'logical_size'¶
- TABLE_KEY = 'table_key'¶