mstrio.modeling.metric package¶
Submodules¶
mstrio.modeling.metric.dimensionality module¶
- class mstrio.modeling.metric.dimensionality.Dimensionality(dimensionality_units: list[mstrio.modeling.metric.dimensionality.DimensionalityUnit] | None = None, exclude_attribute: bool | None = None, allow_adding_unit: bool | None = None, prompt: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None)¶
Bases:
Dictable
Object that specifies the dimensionality.
This class can only be used for simple metrics. For creation and altering of compound metrics, dimensionality needs to be defined through the use of the Expression class.
- dimtyUnits¶
The list of dimty unit
- excludeAttribute¶
boolean whether to exclude attribute absent in report or level(dimensionality)
- allowAddingUnit¶
boolean whether to allow other users to add extra units
- prompt¶
reference to a prompt
- Type:
- allow_adding_unit: bool | None = None¶
- dimensionality_units: list[mstrio.modeling.metric.dimensionality.DimensionalityUnit] | None = None¶
- exclude_attribute: bool | None = None¶
- classmethod from_dict(source: dict, connection: Optional[Connection] = None, to_snake_case: bool = True)¶
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
- prompt: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None¶
- to_dict(camel_case: bool = True) dict ¶
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
- class mstrio.modeling.metric.dimensionality.DimensionalityUnit(dimensionality_unit_type: DimensionalityUnitType, aggregation: mstrio.modeling.metric.dimensionality.DimensionalityUnit.Aggregation | None = None, filtering: mstrio.modeling.metric.dimensionality.DimensionalityUnit.Filtering | None = None, group_by: bool | None = None, relative_position: int | None = None, target: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None, axis_collection: dict | None = None)¶
Bases:
Dictable
Object that specifies the dimensionality unit.
- dimtyUnitType¶
Type of unit in dimensionality
- target¶
target of dimensionality
- Type:
- aggregation¶
type of aggregation in dimensionality
- filtering¶
Type of filtering applied in this dimensionality
- relativePosition¶
number showing relative position of dimensionality
- in metric reports
- target¶
Object reference to attribute or report, on which the
- Type:
- dimensionality will be grouped at
- axisCollection¶
dict of numbers showing, at which axis
- metric will be shown
- class Aggregation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- FIRST_IN_FACT = 'first_in_fact'¶
- FIRST_IN_RELATIONSHIP = 'first_in_relationship'¶
- LAST_IN_FACT = 'last_in_fact'¶
- LAST_IN_RELATIONSHIP = 'last_in_relationship'¶
- NORMAL = 'normal'¶
- class DimensionalityUnitType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- ATTRIBUTE = 'attribute'¶
- DEFAULT = 'default'¶
- DIMENSION = 'dimension'¶
- REPORT_BASE_LEVEL = 'report_base_level'¶
- REPORT_LEVEL = 'report_level'¶
- ROLE = 'role'¶
- class Filtering(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- ABSOLUTE = 'absolute'¶
- APPLY = 'apply'¶
- IGNORE = 'ignore'¶
- NONE = 'none'¶
- aggregation: mstrio.modeling.metric.dimensionality.DimensionalityUnit.Aggregation | None = None¶
- axis_collection: dict | None = None¶
- dimensionality_unit_type: DimensionalityUnitType¶
- filtering: mstrio.modeling.metric.dimensionality.DimensionalityUnit.Filtering | None = None¶
- classmethod from_dict(source: dict)¶
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
- group_by: bool | None = None¶
- relative_position: int | None = None¶
- target: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None¶
- to_dict(camel_case: bool = True) dict ¶
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.modeling.metric.metric module¶
- class mstrio.modeling.metric.metric.DefaultSubtotals(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
- AGGREGATION = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='F225147A4CA0BB97368A5689D9675E73', name=None, is_embedded=None)¶
- AVERAGE = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='B328C60462634223B2387D4ADABEEB53', name=None, is_embedded=None)¶
- COUNT = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='078C50834B484EE29948FA9DD5300ADF', name=None, is_embedded=None)¶
- GEOMETRIC_MEAN = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='E1853D5A36C74F59A9F8DEFB3F9527A1', name=None, is_embedded=None)¶
- MAXIMUM = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='B1F4AA7DE683441BA559AA6453C5113E', name=None, is_embedded=None)¶
- MEDIAN = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='83A663067F7E43B2ABF67FD38ECDC7FE', name=None, is_embedded=None)¶
- MINIMUM = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='00B7BFFF967F42C4B71A4B53D90FB095', name=None, is_embedded=None)¶
- MODE = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='36226A4048A546139BE0AF5F24737BA8', name=None, is_embedded=None)¶
- PRODUCT = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='54E7BFD129514717A92BC44CF1FE5A32', name=None, is_embedded=None)¶
- RESERVED = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='F341109B11D5D528C00084916B98494F', name=None, is_embedded=None)¶
- STANDARD_DEVIATION = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='7FBA414995194BBAB2CF1BB599209824', name=None, is_embedded=None)¶
- SUM_OF_WYA = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='F7AE84A511D78008B00092BE4E571AD0', name=None, is_embedded=None)¶
- TOTAL = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='96C487AF4D12472A910C1ACACFB56EFB', name=None, is_embedded=None)¶
- VARIANCE = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='1769DBFCCF2D4392938E40418C6E065E', name=None, is_embedded=None)¶
- WEIGHTED_YEARLY_AVERAGE = SchemaObjectReference(sub_type=ObjectSubType.SYSTEM_SUBTOTAL, object_id='F7AE852A11D78008B00092BE4E571AD0', name=None, is_embedded=None)¶
- class mstrio.modeling.metric.metric.Metric(connection: Connection, id: str | None = None, name: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TOKENS)¶
Bases:
Entity
,CopyMixin
,MoveMixin
,DeleteMixin
,ModelVldbMixin
,TranslationMixin
Python representation of MicroStrategy Metric object.
- id¶
metric’s ID
- name¶
metric’s name
- sub_type¶
string literal used to identify the type of a metadata object
- description¶
metric’s description
- type¶
object type, ObjectTypes enum
- subtype¶
object subtype, ObjectSubTypes enum
- ext_type¶
object extended type, ExtendedType enum
- ancestors¶
list of ancestor folders
- date_created¶
creation time, DateTime object
- date_modified¶
last modification time, DateTime object
- destination_folder_id¶
a globally unique identifier used to distinguish between metadata objects within the same project
- is_embedded¶
If true indicates that the target object of this reference is embedded within this object. Alternatively if this object is itself embedded, then it means that the target object is embedded in the same container as this object.
- owner¶
User object that is the owner
- acg¶
access rights (See EnumDSSXMLAccessRightFlags for possible values)
- acl¶
object access control list
- version¶
the version number this object is currently carrying
- expression¶
the Expression representing the metric’s formula
- dimensionality¶
the object that specifies the dimensionality
- conditionality¶
the object that specifies the conditionality
- metric_subtotals¶
a list of the enabled subtotals for the metric
- aggregate_from_base¶
bool used to specify whether the metric aggregates from base
- formula_join_type¶
join type of the metric’s formula, FormulaJoinType enumerator
- smart_total¶
whether the metric is decomposable or not, SmartTotal enumerator
- data_type¶
DataType object for metric values
- format¶
MetricFormat object that stores the formatting of the metric
- subtotal_from_base¶
bool used to specify whether the metric is a subtotal from base type
- column_name_alias¶
name for the column representing the metric in SQL
- metric_format_type¶
specifies whether the metric has HTML content, MetricFormatType enumerator
- thresholds¶
list of Threshold for the metric
Specifies whether the object is hidden
- class Conditionality(filter: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None, embed_method: mstrio.modeling.metric.metric.Metric.Conditionality.EmbedMethod | None = None, prompt: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None, remove_elements: bool = False)¶
Bases:
Dictable
Object that specifies the conditionality
This class can only be used for simple metrics. For creation and altering of compound metrics, conditionality needs to be defined through the use of the Expression class.
- filter¶
reference to the filter to be used for the conditionality
- Type:
SchemaObjectReference, optional
- embed_method¶
value of the enumerator that specifies the type of filter interaction between the metric and report filters
- Type:
EmbedMethod, optional
- prompt¶
reference to the prompt to be used for the conditionality, only prompts of the type Prompt Object may be used
- Type:
SchemaObjectReference, optional
- remove_elements¶
whether to remove related filter elements
- Type:
bool
- class EmbedMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- BOTH_FILTERS_TOGETHER = 'both_filters_together'¶
- METRIC_INTO_REPORT_FILTER = 'metric_into_report_filter'¶
- REPORT_INTO_METRIC_FILTER = 'report_into_metric_filter'¶
- embed_method: mstrio.modeling.metric.metric.Metric.Conditionality.EmbedMethod | None = None¶
- filter: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None¶
- prompt: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None¶
- remove_elements: bool = False¶
- class FormulaJoinType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- DEFAULT = 'default'¶
- INNER = 'inner'¶
- OUTER = 'outer'¶
- class MetricFormatType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- HTML_TAG = 'html_tag'¶
- LAST_ONE = 'last_one'¶
- RESERVED = 'reserved'¶
- class MetricSubtotal(definition: mstrio.modeling.schema.helpers.SchemaObjectReference | mstrio.modeling.metric.metric.DefaultSubtotals | None = None, implementation: mstrio.modeling.schema.helpers.SchemaObjectReference | mstrio.modeling.metric.metric.DefaultSubtotals | None = None)¶
Bases:
Dictable
- Object that specifies the subtotal. User can use predefined subtotals
using DefaultSubtotals enum, or specify custom made subtotals using SchemaObjectReference.
- definition¶
Reference to the definition object
- Type:
- implementation¶
Reference to the implementation object. Only used when the definition Subtotal is ‘Total’ to specify what the default subtotal type for the Total should be
- Type:
- class SmartTotal(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- DECOMPOSABLE_FALSE = 'decomposable_false'¶
- DECOMPOSABLE_TRUE = 'decomposable_true'¶
- alter(name: str | None = None, destination_folder_id: str | None = None, expression: mstrio.modeling.expression.expression.Expression | None = None, description: str | None = None, dimensionality: mstrio.modeling.metric.dimensionality.Dimensionality | None = None, conditionality: mstrio.modeling.metric.metric.Metric.Conditionality | None = None, metric_subtotals: list[mstrio.modeling.metric.metric.Metric.MetricSubtotal] | None = None, aggregate_from_base: bool = False, formula_join_type: mstrio.modeling.metric.metric.Metric.FormulaJoinType | None = FormulaJoinType.DEFAULT, smart_total: mstrio.modeling.metric.metric.Metric.SmartTotal | None = None, data_type: mstrio.modeling.schema.helpers.DataType | None = None, format: mstrio.modeling.metric.metric_format.MetricFormat | None = None, subtotal_from_base: bool = False, column_name_alias: str | None = None, metric_format_type: mstrio.modeling.metric.metric.Metric.MetricFormatType | None = None, thresholds: list[mstrio.modeling.metric.metric.Threshold] | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TOKENS, hidden: bool | None = None, comments: str | None = None)¶
Alter a metric’s specified properties
- Parameters:
name – metric’s name
destination_folder_id – A globally unique identifier used to distinguish between metadata objects within the same project. It is possible for two metadata objects in different projects to have the same Object Id.
expression – the Expression representing the metric’s formula
description – metric’s description
dimensionality – the object that specifies the dimensionality
conditionality – the object that specifies the conditionality
metric_subtotals – a list of the enabled subtotals for the metric
aggregate_from_base – bool used to specify whether the metric aggregates from base
formula_join_type – join type of the metric’s formula, FormulaJoinType enumerator
smart_total – whether the metric is decomposable or not, SmartTotal enumerator
data_type – DataType object for metric values
format – MetricFormat object that stores the formatting of the metric
subtotal_from_base – bool used to specify whether the metric is a subtotal from base type
column_name_alias – name of the column representing the metric in SQL
metric_format_type – specifies whether the metric has HTML content, MetricFormatType enumerator
thresholds – list of Threshold for the metric
show_expression_as (ExpressionFormat, str) – specify how expressions should be presented Available values: - ExpressionFormat.TREE or tree - ExpressionFormat.TOKENS or `tokens (default)
hidden – Specifies whether the metric is hidden
- classmethod create(connection: Connection, name: str, sub_type: mstrio.modeling.schema.helpers.ObjectSubType | str, destination_folder: mstrio.object_management.folder.Folder | str, expression: Expression, description: str | None = None, is_embedded: bool = False, dimensionality: mstrio.modeling.metric.dimensionality.Dimensionality | None = None, conditionality: mstrio.modeling.metric.metric.Metric.Conditionality | None = None, metric_subtotals: list[mstrio.modeling.metric.metric.Metric.MetricSubtotal] | None = None, aggregate_from_base: bool = False, formula_join_type: mstrio.modeling.metric.metric.Metric.FormulaJoinType | None = FormulaJoinType.DEFAULT, smart_total: mstrio.modeling.metric.metric.Metric.SmartTotal | None = None, data_type: mstrio.modeling.schema.helpers.DataType | None = None, format: mstrio.modeling.metric.metric_format.MetricFormat | None = None, subtotal_from_base: bool = False, column_name_alias: str | None = None, metric_format_type: mstrio.modeling.metric.metric.Metric.MetricFormatType | None = None, thresholds: list[mstrio.modeling.metric.metric.Threshold] | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TOKENS, hidden: bool | None = None) Metric ¶
Create a new metric with specified properties.
- Parameters:
connection – MicroStrategy connection object returned by connection.Connection()
name – metric’s name
sub_type – metric’s sub_type
destination_folder – A globally unique identifier used to distinguish between metadata objects within the same project. It is possible for two metadata objects in different projects to have the same Object Id
description – metric’s description
is_embedded – If true indicates that the target object of this reference is embedded within this object. Alternatively if this object is itself embedded, then it means that the target object is embedded in the same container as this object.
expression – the Expression representing the metric’s formula
dimensionality – the object that specifies the dimensionality
conditionality – the object that specifies the conditionality
metric_subtotals – a list of the enabled subtotals for the metric
aggregate_from_base – bool used to specify whether the metric aggregates from base
formula_join_type – join type of the metric’s formula, FormulaJoinType enumerator
smart_total – whether the metric is decomposable or not, SmartTotal enumerator
data_type – DataType object for metric values
format – MetricFormat object that stores the formatting of the metric
subtotal_from_base – bool used to specify whether the metric is a subtotal from base type
column_name_alias – name of the column representing the metric in SQL
metric_format_type – specifies whether the metric has HTML content, MetricFormatType enumerator
thresholds – list of Threshold for the metric
show_expression_as (ExpressionFormat, str) – specify how expressions should be presented Available values: - ExpressionFormat.TREE or tree - ExpressionFormat.TOKENS or `tokens (default)
hidden (bool, optional) – Specifies whether the object is hidden. Default value: False.
- Returns:
Metric class object.
- classmethod from_dict(source: dict, connection: Optional[Connection] = None, with_missing_value: bool = False)¶
- 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: bool = True) dict ¶
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
- class mstrio.modeling.metric.metric.Threshold(format: list[mstrio.modeling.metric.metric_format.FormatProperty], condition: mstrio.modeling.expression.expression.Expression | None = None, name: str | None = None, replace_text: str | None = None, semantics: mstrio.modeling.metric.metric.Threshold.Semantics | None = None, scope: mstrio.modeling.metric.metric.Threshold.Scope | None = None, enable: bool = True)¶
Bases:
Dictable
Object that specifies a threshold
- format¶
list of format properties for the threshold
- Type:
list[FormatProperty]
- condition¶
expression that specifies the condition on which the threshold is going to be applied
- Type:
Expression, optional
- name¶
name of the threshold
- Type:
string, optional
- replace_text¶
text that will replace the metric’s value if the threshold is met
- Type:
string, optional
- semantics¶
value of an enumerator that specifies the type of replacement in the replace_text string
- Type:
Semantics, optional
- scope¶
value of an enumerator that specifies what the threshold applies to, the metric values, the subtotal value or both
- Type:
Scope, optional
- enable¶
whether the threshold is enabled or not, True by default
- Type:
bool
- class Scope(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- METRIC_AND_SUBTOTAL = 'metric_and_subtotal'¶
- METRIC_ONLY = 'metric_only'¶
- SUBTOTAL_ONLY = 'subtotal_only'¶
- class Semantics(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- NUMBER = 'number'¶
- PICTURE = 'picture'¶
- SYMBOL = 'symbol'¶
- TEXT = 'text'¶
- condition: mstrio.modeling.expression.expression.Expression | None = None¶
- enable: bool = True¶
- format: list[mstrio.modeling.metric.metric_format.FormatProperty]¶
- name: str | None = None¶
- replace_text: str | None = None¶
- scope: mstrio.modeling.metric.metric.Threshold.Scope | None = None¶
- semantics: mstrio.modeling.metric.metric.Threshold.Semantics | None = None¶
- mstrio.modeling.metric.metric.list_metrics(connection: Connection, name: str | None = None, metric_type: ObjectTypes = ObjectTypes.METRIC, project_id: str | None = None, project_name: str | None = None, to_dictionary: bool = False, limit: int | None = None, search_pattern: mstrio.object_management.search_enums.SearchPattern | int = SearchPattern.CONTAINS, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TOKENS, **filters) list[mstrio.modeling.metric.metric.Metric] | list[dict] ¶
Get list of Metric objects or dicts with them.
Optionally use to_dictionary to choose output format.
- Wildcards available for ‘name’:
? - any character * - 0 or more of any characters e.g. name_begins = ?onny will return Sonny and Tonny
Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.
Note
When project_id is None and project_name is None, then its value is overwritten by project_id from connection object.
- Parameters:
connection – MicroStrategy connection object returned by connection.Connection()
name (str, optional) – characters that the metric name must begin with
metric_type (ObjectTypes) – one of metric subtypes: Metric or AggMetric
project_id (str, optional) – ID of the project to list the metrics from
project_name (str, optional) – Project name
to_dictionary (bool, optional) – If True returns dict, by default (False) returns Metric objects
limit (integer, optional) – limit the number of elements returned. If None all object are returned.
search_pattern (SearchPattern enum or int, optional) – pattern to search for, such as Begin With or Exactly. Possible values are available in ENUM mstrio.object_management.SearchPattern. Default value is CONTAINS (4).
show_expression_as (ExpressionFormat, str) –
specify how expressions should be presented Available values:
ExpressionFormat.TREE or tree
ExpressionFormat.TOKENS or `tokens (default)
**filters –
Available filter parameters: id (str): Metric’s ID name (str): Metric’s name date_created (str): format: 2001-01-02T20:48:05.000+0000 date_modified (str): format: 2001-01-02T20:48:05.000+0000 version (str): Metric’s version owner dict: e.g. {‘id’: <user’s id>, ‘name’: <user’s name>},
with one or both of the keys: id, name
acg (str | int): access control group
- Returns:
list with Metric objects or list of dictionaries
mstrio.modeling.metric.metric_format module¶
- class mstrio.modeling.metric.metric_format.FormatProperty(type: FormatType, value: Union[str, Color])¶
Bases:
Dictable
Object that specifies a single format type and it’s value
- type¶
specify what format type is to be set
- Type:
- value¶
specify what value to set the specified format type to
- Type:
string
- FormatType Values:
- Number Category - integer between 0 and 9, default is 9:
0 - Fixed 1 - Currency 2 - Date 3 - Time 4 - Percent 5 - Fraction 6 - Scientific 7 - Custom 8 - Special 9 - General
Number Decimal Places - integer between 0 and 30, default is 0 Number Thousand Separator - boolean (true or false), default is true Number Currency Symbol - string of 1-4 characters, default is $ Number Currency Position - integer between 0 and 3, default is 0:
0 - at the beginning, for example $10 1 - at the end, for example 10$ 2 - at the beginning with extra space, for example $ 10 3 - at the end with extra space, for example 10 $
- Number Format - string of maximum of 255 characters, default value is
General, example value: ###0.00;[RED]-###0.00
- Number Negative Numbers - integer between 1 and 5, default is 3:
1 - normal negative format, for example -10 2 - red color represents negative, -10 would be 10 in red color 3 - parentheses represent negative, -10 would be (10) 4 - both red color and parentheses represent negative, -10 would be
in red color
- 5 - minus sign and red color represent negative, -10 would be -10
in red color
- Alignment Horizontal - integer between 1 and 5, default value is 1:
1 - General 2 - Left 3 - Center 4 - Right 5 - Fill
- Alignment Vertical - integer between 1 and 3, default value is 1:
1 - Top 2 - Center 3 - Bottom
Alignment Text Wrap - boolean (true or false), default is false Alignment Text Direction - allowed values are -90, 0 and 90 Padding Left - double between 0.0 and 100.0, default value is 1.0 Padding Right - double between 0.0 and 100.0, default value is 1.0 Padding Top - double between 0.0 and 100.0, default value is 1.0 Padding Bottom - double between 0.0 and 100.0, default value is 1.0 Font Name - string representing font, default is Arial, if provided
font name does not exist or is not supported, default is used
Font Bold - boolean (true or false), default is false Font Italic - boolean (true or false), default is false Font Size - integer between 1 and 2147483647, recommended usable range
is between 8 and 72, other font sizes might render format unreadable
Font Strikeout - boolean (true or false), default is false Font Underline - boolean (true or false), default is false Font Color - FormatProperty.Color object representing font color in hex,
RGB and server readable formats
- Font Script - integer between 1 and 2147483647, default value is 0,
value represents corresponding font script, if the value has no corresponding script, the default will be used
- Border Top Style - integer between 0 and 6, default value is 1:
0 - empty border 1 - thin border 2 - hair border 3 - dashed border 4 - dotted border 5 - thick border 6 - double border
Border Right Style - the same rules as Top Style Border Left Style - the same rules as Top Style Border Bottom Style - the same rules as Top Style Border Top Color - FormatProperty.Color object representing border top
color in hex, RGB and server readable formats
- Border Right Color - FormatProperty.Color object representing border
right color in hex, RGB and server readable formats
- Border Left Color - FormatProperty.Color object representing border
left color in hex, RGB and server readable formats
- Border Bottom Color - FormatProperty.Color object representing border
bottom color in hex, RGB and server readable formats
- Background Fill Style - integer between 0 and 3, default value is 0:
0 - solid, only has fill color 1 - transparent 2 - gradient, has fill color and gradient color 3 - pattern, has fill color and gradient color
- Background Fill Color - FormatProperty.Color object representing
background fill color in hex, RGB and server readable formats
- Background Pattern Color - FormatProperty.Color object representing
background fill color in hex, RGB and server readable formats
Background Pattern Style - integer between 1 and 18, default value is 1 Background Gradient Color - FormatProperty.Color object representing
background gradient color in hex, RGB and server readable formats
Background Gradient Angle - allowed values are -90, 0 and 90 Gradient X Offset - allowed values are 0, 50 and 100 Gradient Y Offset - allowed values are 0, 50 and 100
- class Color(hex_value: str | None = None, red: int | None = None, green: int | None = None, blue: int | None = None, server_value: str | None = None)¶
Bases:
Dictable
- A class containing information about the color in different formats.
It is used as a value for FormatProperties that type related with colors.
- hex_value¶
color expressed in hex format (e.g. ‘#ff02ef’)
- Type:
str
- server_value¶
color translated for server readable format
- Type:
str
- red¶
red component of a RGB format, expressed as decimal
- Type:
str
- green¶
green component of a RGB format, expressed as decimal
- Type:
str
- blue¶
blue component of a RGB format, expressed as decimal
- Type:
str
- blue: str¶
- green: str¶
- hex_value: str¶
- red: str¶
- server_value: str¶
- class FormatType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
AutoName
- ALIGNMENT_HORIZONTAL = 'alignment_horizontal'¶
- ALIGNMENT_TEXT_DIRECTION = 'alignment_text_direction'¶
- ALIGNMENT_TEXT_WRAP = 'alignment_text_wrap'¶
- ALIGNMENT_VERTICAL = 'alignment_vertical'¶
- BACKGROUND_FILL_COLOR = 'background_fill_color'¶
- BACKGROUND_FILL_STYLE = 'background_fill_style'¶
- BACKGROUND_GRADIENT_ANGLE = 'background_gradient_angle'¶
- BACKGROUND_GRADIENT_COLOR = 'background_gradient_color'¶
- BACKGROUND_GRADIENT_X_OFFSET = 'background_gradient_x_offset'¶
- BACKGROUND_GRADIENT_Y_OFFSET = 'background_gradient_y_offset'¶
- BACKGROUND_PATTERN_COLOR = 'background_pattern_color'¶
- BACKGROUND_PATTERN_STYLE = 'background_pattern_style'¶
- BORDER_BOTTOM_COLOR = 'border_bottom_color'¶
- BORDER_BOTTOM_STYLE = 'border_bottom_style'¶
- BORDER_LEFT_COLOR = 'border_left_color'¶
- BORDER_LEFT_STYLE = 'border_left_style'¶
- BORDER_RIGHT_COLOR = 'border_right_color'¶
- BORDER_RIGHT_STYLE = 'border_right_style'¶
- BORDER_TOP_COLOR = 'border_top_color'¶
- BORDER_TOP_STYLE = 'border_top_style'¶
- FONT_BOLD = 'font_bold'¶
- FONT_COLOR = 'font_color'¶
- FONT_ITALIC = 'font_italic'¶
- FONT_NAME = 'font_name'¶
- FONT_SCRIPT = 'font_script'¶
- FONT_SIZE = 'font_size'¶
- FONT_STRIKEOUT = 'font_strikeout'¶
- FONT_UNDERLINE = 'font_underline'¶
- NUMBER_CATEGORY = 'number_category'¶
- NUMBER_CURRENCY_POSITION = 'number_currency_position'¶
- NUMBER_CURRENCY_SYMBOL = 'number_currency_symbol'¶
- NUMBER_DECIMAL_PLACES = 'number_decimal_places'¶
- NUMBER_FORMAT = 'number_format'¶
- NUMBER_NEGATIVE_NUMBERS = 'number_negative_numbers'¶
- NUMBER_THOUSAND_SEPARATOR = 'number_thousand_separator'¶
- PADDING_BOTTOM = 'padding_bottom'¶
- PADDING_LEFT = 'padding_left'¶
- PADDING_RIGHT = 'padding_right'¶
- PADDING_TOP = 'padding_top'¶
- classmethod from_dict(source: dict[str, Any], connection: Optional[Connection] = None, to_snake_case: bool = True) FormatProperty ¶
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
- to_dict(camel_case: bool = True) dict ¶
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
- type: FormatType¶
- value: Union[str, FormatProperty.Color]¶
- class mstrio.modeling.metric.metric_format.MetricFormat(values: list[mstrio.modeling.metric.metric_format.FormatProperty], header: list[mstrio.modeling.metric.metric_format.FormatProperty])¶
Bases:
Dictable
Object that specifies the formatting of the metric’s values and headers
- values¶
list of format properties for the values of the metric
- Type:
list[FormatProperty]
- header¶
list of format properties for the header of the metric
- Type:
list[FormatProperty]
- header: list[mstrio.modeling.metric.metric_format.FormatProperty]¶
- values: list[mstrio.modeling.metric.metric_format.FormatProperty]¶