mstrio.modeling.expression package

Submodules

mstrio.modeling.expression.dynamic_date_time module

class mstrio.modeling.expression.dynamic_date_time.AdjustmentMonthlyByDay(day: int)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the month level by day

day

day of month (1 - 31)

Type

int

day: int
class mstrio.modeling.expression.dynamic_date_time.AdjustmentMonthlyByDayOfWeek(week_ordinal: int, day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the month level by day of week

week_ordinal

number indicating 1st, 2nd, 3rd, etc.

Type

int

day_of_week

day of week, value of DayOfWeek enum

Type

mstrio.modeling.expression.dynamic_date_time.DayOfWeek

day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek
week_ordinal: int
class mstrio.modeling.expression.dynamic_date_time.AdjustmentMonthlyByReverseCount(days: int, months: int)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the month level by reverse count

days

number of days to reverse count

Type

int

months

number of months to reverse count

Type

int

days: int
months: int
class mstrio.modeling.expression.dynamic_date_time.AdjustmentNone

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Indicate that there is no further adjustments

class mstrio.modeling.expression.dynamic_date_time.AdjustmentQuarterlyByDay(day: int)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the quarter level by day

day

day in the quarter

Type

int

day: int
class mstrio.modeling.expression.dynamic_date_time.AdjustmentQuarterlyByDayOfWeek(month_ordinal: int, week_ordinal: int, day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the quarter level by day of week

month_ordinal

number indicating 1st, 2nd, or 3rd month in the quarter

Type

int

week_ordinal

number indicating 1st, 2nd, 3rd, etc.

Type

int

day_of_week

day of week, value of DayOfWeek enum

Type

mstrio.modeling.expression.dynamic_date_time.DayOfWeek

day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek
month_ordinal: int
week_ordinal: int
class mstrio.modeling.expression.dynamic_date_time.AdjustmentQuarterlyByReverseCount(days: int)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the quarter level by reverse count

days

number of days to reverse count

Type

int

days: int
class mstrio.modeling.expression.dynamic_date_time.AdjustmentWeeklyByDayOfWeek(day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the week level by day of week

day_of_week

day of week, value of DayOfWeek enum

Type

mstrio.modeling.expression.dynamic_date_time.DayOfWeek

day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek
class mstrio.modeling.expression.dynamic_date_time.AdjustmentYearlyByDate(month: int, day: int)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the year level by date

month

Month of the year (1 - 12)

Type

int

day

Day of month (1 - 31)

Type

int

day: int
month: int
class mstrio.modeling.expression.dynamic_date_time.AdjustmentYearlyByDayOfWeek(month: int, week_ordinal: int, day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek)

Bases: mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Adjustment at the year level by day of week

month

Month of the year (1 - 12)

Type

int

week_ordinal

Number indicating 1st, 2nd, 3rd, etc.

Type

int

day_of_week

day of week, value of DayOfWeek enum

Type

mstrio.modeling.expression.dynamic_date_time.DayOfWeek

day_of_week: mstrio.modeling.expression.dynamic_date_time.DayOfWeek
month: int
week_ordinal: int
class mstrio.modeling.expression.dynamic_date_time.DateAdjustment

Bases: mstrio.utils.helper.Dictable

Base class for date adjustment objects

class mstrio.modeling.expression.dynamic_date_time.DateMode(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating mode of date

DYNAMIC = 'dynamic'
STATIC = 'static'
class mstrio.modeling.expression.dynamic_date_time.DayOfWeek(value)

Bases: enum.Enum

Enumeration used to indicate day of week

FRIDAY = 5
MONDAY = 1
SATURDAY = 6
SUNDAY = 0
THURSDAY = 4
TUESDAY = 2
WEDNESDAY = 3
class mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeStructure(type: mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeType, date: Optional[mstrio.modeling.expression.dynamic_date_time.VersatileDate] = None, time: Optional[mstrio.modeling.expression.dynamic_date_time.VersatileTime] = None)

Bases: mstrio.utils.helper.Dictable

Object that represents a date/time. It can be date-only, or time-only, or date-time. The date part and the time part can be dynamic or static independently. Typically, this object is used when at least one of the two parts is dynamic. Although it’s capable of describing a static date/time, the much simpler Variant is preferable in that case.

type

represents what part is being used, either date, time or date/time

Type

mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeType

date

Object that represents either a dynamic date or a static date

Type

Optional[mstrio.modeling.expression.dynamic_date_time.VersatileDate]

time

Object that represents either a dynamic time or a static time

Type

Optional[mstrio.modeling.expression.dynamic_date_time.VersatileTime]

date: Optional[mstrio.modeling.expression.dynamic_date_time.VersatileDate] = None
time: Optional[mstrio.modeling.expression.dynamic_date_time.VersatileTime] = None
type: mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeType
class mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating type of dynamic date time object

DATE = 'date'
DATE_TIME = 'date_time'
TIME = 'time'
class mstrio.modeling.expression.dynamic_date_time.DynamicVersatileDate(day_offset: int, month_offset: int, adjustment: mstrio.modeling.expression.dynamic_date_time.DateAdjustment = AdjustmentNone(), exclude_weekends: Optional[bool] = None)

Bases: mstrio.modeling.expression.dynamic_date_time.VersatileDate

Object that represents a dynamic date. Its various settings define a function that will resolve to a date using the current date as the input.

day_offset

The day offset

Type

int

month_offset

The month offset

Type

int

exclude_weekends

Whether weekend days should be excluded during calculation, default: False

Type

Optional[bool]

adjustment

adjustment of a date, instance of one of classes inheriting from DateAdjustment class

Type

mstrio.modeling.expression.dynamic_date_time.DateAdjustment

adjustment: mstrio.modeling.expression.dynamic_date_time.DateAdjustment = AdjustmentNone()
day_offset: int
exclude_weekends: Optional[bool] = None
classmethod from_dict(source: dict, connection: Optional[Connection] = None, to_snake_case=True) DynamicVersatileDate

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.

Returns

An object of type T.

Return type

T

month_offset: int
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.expression.dynamic_date_time.HourMode(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating mode of hour

DYNAMIC = 'dynamic'
STATIC = 'static'
class mstrio.modeling.expression.dynamic_date_time.MinuteAndSecondMode(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating mode of minute and second

DYNAMIC = 'dynamic'
STATIC = 'static'
class mstrio.modeling.expression.dynamic_date_time.StaticVersatileDate(value: str)

Bases: mstrio.modeling.expression.dynamic_date_time.VersatileDate

Object that represents a static date

value

ISO 8601 string of the date component

Type

str

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

value: str
class mstrio.modeling.expression.dynamic_date_time.VersatileDate

Bases: mstrio.utils.helper.Dictable

Base class for classes representing dynamic or static date objects

static dispatch(source, connection: Optional[Connection] = None) Type[VersatileDate]
class mstrio.modeling.expression.dynamic_date_time.VersatileTime(hour_mode: mstrio.modeling.expression.dynamic_date_time.HourMode, minute_and_second_mode: mstrio.modeling.expression.dynamic_date_time.MinuteAndSecondMode, hour: Optional[int] = None, hour_offset: Optional[int] = None, minute: Optional[int] = None, minute_offset: Optional[int] = None, second: Optional[int] = None, second_offset: Optional[int] = None)

Bases: mstrio.utils.helper.Dictable

Object that represents either a dynamic time or a static time

hour_mode

The hour component (0-23). Used when the hour is static.

Type

mstrio.modeling.expression.dynamic_date_time.HourMode

hour_offset

The offset from the current hour. Used when the hour is dynamic.

Type

Optional[int]

minute_and_second_mode

The minute component (0-59). Used when the minute is static.

Type

mstrio.modeling.expression.dynamic_date_time.MinuteAndSecondMode

minute_offset

The offset from the current minute. Used when the minute is dynamic.

Type

Optional[int]

second

The second component (0-59). Used when the second is static.

Type

Optional[int]

second_offset

The offset from the current second. Used when the second is dynamic.

Type

Optional[int]

hour: Optional[int] = None
hour_mode: mstrio.modeling.expression.dynamic_date_time.HourMode
hour_offset: Optional[int] = None
minute: Optional[int] = None
minute_and_second_mode: mstrio.modeling.expression.dynamic_date_time.MinuteAndSecondMode
minute_offset: Optional[int] = None
second: Optional[int] = None
second_offset: Optional[int] = None

mstrio.modeling.expression.enums module

class mstrio.modeling.expression.enums.DependenceType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating the dependence type of expression node

DEFAULT = 'default'
DEPENDENT = 'dependent'
INDEPENDENT = 'independent'
class mstrio.modeling.expression.enums.DimtyType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating the dimty type of expression node

BREAK_BY = 'break_by'
CONTINUATION = 'continuation'
EMBEDDED = 'embedded'
EXCLUSIVE_CONTINUATION = 'exclusive_continuation'
NONE = 'none'
OUTPUT_LEVEL = 'output_level'
PARAMETER = 'parameter'
UNSPECIFIED = 'unspecified'
class mstrio.modeling.expression.enums.ExpressionType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating the expression type of expression node

AGG_METRIC = 'agg_metric'
BANDING = 'banding'
CANCELED_PROMPT = 'canceled_prompt'
CSI_DELETE = 'csi_delete'
CSI_GROUP = 'csi_group'
CSI_INSERT = 'csi_insert'
CSI_UPDATE = 'csi_update'
DYNAMIC = 'dynamic'
ELEMENT_LIST = 'element_list'
ELEMENT_SINGLE = 'element_single'
FILTER_ALL_ATTRIBUTE_QUAL = 'filter_all_attribute_qual'
FILTER_ATTRIBUTE_DESC_QUAL = 'filter_attribute_desc_qual'
FILTER_ATTRIBUTE_ID_QUAL = 'filter_attribute_id_qual'
FILTER_BRANCH_QUAL = 'filter_branch_qual'
FILTER_EMBED_QUAL = 'filter_embed_qual'
FILTER_JOINT_FORM_QUAL = 'filter_joint_form_qual'
FILTER_JOINT_LIST_FORM_QUAL = 'filter_joint_list_form_qual'
FILTER_JOINT_LIST_QUAL = 'filter_joint_list_qual'
FILTER_LIST_FORM_QUAL = 'filter_list_form_qual'
FILTER_LIST_QUAL = 'filter_list_qual'
FILTER_METRIC_EXPRESSION = 'filter_metric_expression'
FILTER_MULTI_BASE_FORM_QUAL = 'filter_multi_base_form_qual'
FILTER_MULTI_METRIC_QUAL = 'filter_multi_metric_qual'
FILTER_RELATIONSHIP_QUAL = 'filter_relationship_qual'
FILTER_REPORT_QUAL = 'filter_report_qual'
FILTER_SINGLE_BASE_FORM_EXPRESSION = 'filter_single_base_form_expression'
FILTER_SINGLE_BASE_FORM_QUAL = 'filter_single_base_form_qual'
FILTER_SINGLE_METRIC_QUAL = 'filter_single_metric_qual'
FORM_OF_THIS_ATTRIBUTE = 'form_of_this_attribute'
GENERIC = 'generic'
MDX_SAP_VARIABLE = 'mdx_sap_variable'
SQL_QUERY_QUAL = 'sql_query_qual'
STATIC = 'static'
class mstrio.modeling.expression.enums.Function(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant used to specify the function used for calculation in expression nodes

ABS = 'abs'
ADD = 'add'
ADD_DAYS = 'add_days'
ADD_MONTHS = 'add_months'
AMPERSAND = 'ampersand'
ANCESTORS = 'ancestors'
AND = 'and'
APPLY_AGGREGATION = 'apply_aggregation'
APPLY_COMPARISON = 'apply_comparison'
APPLY_CS_SECURITY_FILTER = 'apply_cs_security_filter'
APPLY_LOGIC = 'apply_logic'
APPLY_OPTIONAL = 'apply_optional'
APPLY_RELATIVE = 'apply_relative'
APPLY_SIMPLE = 'apply_simple'
AVERAGE = 'average'
AVG = 'avg'
BANDING = 'banding'
BANDING_C = 'banding_c'
BANDING_M = 'banding_m'
BANDING_P = 'banding_p'
BAND_NAMES = 'band_names'
BEGINS_WITH = 'begins_with'
BETWEEN = 'between'
BETWEEN_ENHANCED = 'between_enhanced'
BIT_AND = 'bit_and'
BIT_LEFT_SHIFT = 'bit_left_shift'
BIT_NOT = 'bit_not'
BIT_OR = 'bit_or'
BIT_RIGHT_SHIFT = 'bit_right_shift'
BIT_XOR = 'bit_xor'
CASE = 'case'
CASE_V = 'case_v'
CHILDREN = 'children'
COALESCE = 'coalesce'
CONCAT = 'concat'
CONCAT_AGG = 'concat_agg'
CONCAT_NO_BLANK = 'concat_no_blank'
CONTAINS = 'contains'
COUNT = 'count'
CURRENT_DATE = 'current_date'
CURRENT_DATE_TIME = 'current_date_time'
CURRENT_TIME = 'current_time'
CUSTOM = 'custom'
DATE = 'date'
DATE_DIFF = 'date_diff'
DAYS_BETWEEN = 'days_between'
DAY_OF_MONTH = 'day_of_month'
DAY_OF_WEEK = 'day_of_week'
DAY_OF_YEAR = 'day_of_year'
DESCENDANTS = 'descendants'
DIVIDE = 'divide'
ENDS_WITH = 'ends_with'
EQUALS = 'equals'
EQUAL_ENHANCED = 'equal_enhanced'
EXCEPT = 'except'
EXP_WGH_MOVING_AVG = 'exp_wgh_moving_avg'
EXP_WGH_RUNNING_AVG = 'exp_wgh_running_avg'
FIRST = 'first'
FIRST_IN_RANGE = 'first_in_range'
FISCAL_MONTH = 'fiscal_month'
FISCAL_QUARTER = 'fiscal_quarter'
FISCAL_WEEK = 'fiscal_week'
FISCAL_YEAR = 'fiscal_year'
GEOMEAN = 'geomean'
GET_EXTRA_OUTPUT = 'get_extra_output'
GREATER = 'greater'
GREATER_EQUAL = 'greater_equal'
GREATER_EQUAL_ENHANCED = 'greater_equal_enhanced'
GREATEST = 'greatest'
HISTOGRAM_MEDIAN = 'histogram_median'
HOUR = 'hour'
IF = 'if'
IF_BY_DIMTY = 'if_by_dimty'
IN = 'in'
INIT_CAP = 'init_cap'
INTERSECT = 'intersect'
INTERSECT_IN = 'intersect_in'
IS_NOT_NULL = 'is_not_null'
IS_NULL = 'is_null'
LAG = 'lag'
LAST = 'last'
LAST_IN_RANGE = 'last_in_range'
LEAD = 'lead'
LEAST = 'least'
LEFT_STR = 'left_str'
LENGTH = 'length'
LESS = 'less'
LESS_EQUAL = 'less_equal'
LESS_EQUAL_ENHANCED = 'less_equal_enhanced'
LIKE = 'like'
LOWER = 'lower'
L_TRIM = 'l_trim'
MAX = 'max'
MEDIAN = 'median'
MILLI_SECOND = 'milli_second'
MIN = 'min'
MINUS = 'minus'
MINUTE = 'minute'
MODE = 'mode'
MONTH = 'month'
MONTHS_BETWEEN = 'months_between'
MONTH_END_DATE = 'month_end_date'
MONTH_START_DATE = 'month_start_date'
MOVING_AVG = 'moving_avg'
MOVING_COUNT = 'moving_count'
MOVING_DIFFERENCE = 'moving_difference'
MOVING_MAX = 'moving_max'
MOVING_MIN = 'moving_min'
MOVING_STDEV = 'moving_stdev'
MOVING_STDEV_P = 'moving_stdev_p'
MOVING_SUM = 'moving_sum'
MULTIPLY = 'multiply'
NOT = 'not'
NOT_BEGINS_WITH = 'not_begins_with'
NOT_BETWEEN = 'not_between'
NOT_BETWEEN_ENHANCED = 'not_between_enhanced'
NOT_CONTAINS = 'not_contains'
NOT_ENDS_WITH = 'not_ends_with'
NOT_EQUAL = 'not_equal'
NOT_EQUAL_ENHANCED = 'not_equal_enhanced'
NOT_IN = 'not_in'
NOT_LIKE = 'not_like'
NULL_TO_EMPTY = 'null_to_empty'
NULL_TO_ZERO = 'null_to_zero'
N_TILE = 'n_tile'
N_TILE_S = 'n_tile_s'
N_TILE_VS = 'n_tile_vs'
OLAP_AVG = 'olap_avg'
OLAP_COUNT = 'olap_count'
OLAP_MAX = 'olap_max'
OLAP_MIN = 'olap_min'
OLAP_RANK = 'olap_rank'
OLAP_SUM = 'olap_sum'
OR = 'or'
ORDINAL_RANK = 'ordinal_rank'
PARENTS = 'parents'
PERCENTILE = 'percentile'
PERCENT_RANK = 'percent_rank'
PERCENT_RANK_RELATIVE = 'percent_rank_relative'
PLUS = 'plus'
POSITION = 'position'
PRODUCT = 'product'
QUARTER = 'quarter'
QUARTER_START_DATE = 'quarter_start_date'
RANK = 'rank'
REPEAT = 'repeat'
RIGHT_STR = 'right_str'
RUNNING_AVG = 'running_avg'
RUNNING_COUNT = 'running_count'
RUNNING_MAX = 'running_max'
RUNNING_MIN = 'running_min'
RUNNING_STDEV = 'running_stdev'
RUNNING_STDEV_P = 'running_stdev_p'
RUNNING_SUM = 'running_sum'
R_TRIM = 'r_trim'
SEARCH = 'search'
SECOND = 'second'
STDEV = 'stdev'
STDEV_P = 'stdev_p'
STR_BEGINS_WITH = 'str_begins_with'
STR_CHAR = 'str_char'
STR_ENDS_WITH = 'str_ends_with'
STR_LAST_POSITION = 'str_last_position'
STR_MATCH = 'str_match'
STR_REPEAT = 'str_repeat'
STR_REPLACE = 'str_replace'
STR_SPLIT = 'str_split'
STR_TITLE_CAP = 'str_title_cap'
SUB_STR = 'sub_str'
SUM = 'sum'
THIRD_PARTY = 'third_party'
TIMES = 'times'
TO_DATE_TIME = 'to_date_time'
TO_NUMBER = 'to_number'
TO_STRING = 'to_string'
TRIM = 'trim'
TUPLE = 'tuple'
UCASE = 'ucase'
UNARY_MINUS = 'unary_minus'
UNION = 'union'
VALUE_SEGMENT = 'value_segment'
VAR = 'var'
VAR_P = 'var_p'
WEEK = 'week'
WEEK_START_DATE = 'week_start_date'
WEIGHT_CORR = 'weight_corr'
WEIGHT_COV = 'weight_cov'
WEIGHT_MEAN_AVE = 'weight_mean_ave'
WEIGHT_STD_P = 'weight_std_p'
YEAR = 'year'
YEAR_END_DATE = 'year_end_date'
YEAR_START_DATE = 'year_start_date'
ZERO_TO_NULL = 'zero_to_null'
class mstrio.modeling.expression.enums.IsIndependent(value)

Bases: enum.Enum

Flag that indicates whether a node will be evaluated independently of other parts of the larger expression

NO = 0
YES = 1
class mstrio.modeling.expression.enums.NodeType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating the type of node within the expression tree

COLUMN_REFERENCE = 'column_reference'
CONSTANT = 'constant'
DYNAMIC_DATE_TIME = 'dynamic_date_time'
FORM_SHORTCUT = 'form_shortcut'
OBJECT_REFERENCE = 'object_reference'
OPERATOR = 'operator'
PREDICATE_BANDING_COUNT = 'predicate_banding_count'
PREDICATE_BANDING_DISTINCT = 'predicate_banding_distinct'
PREDICATE_BANDING_POINTS = 'predicate_banding_points'
PREDICATE_BANDING_SIZE = 'predicate_banding_size'
PREDICATE_CUSTOM = 'predicate_custom'
PREDICATE_ELEMENT_LIST = 'predicate_element_list'
PREDICATE_FILTER_QUALIFICATION = 'predicate_filter_qualification'
PREDICATE_FORM_QUALIFICATION = 'predicate_form_qualification'
PREDICATE_JOINT_ELEMENT_LIST = 'predicate_joint_element_list'
PREDICATE_METRIC_QUALIFICATION = 'predicate_metric_qualification'
PREDICATE_PROMPT_QUALIFICATION = 'predicate_prompt_qualification'
PREDICATE_RELATIONSHIP = 'predicate_relationship'
PREDICATE_REPORT_QUALIFICATION = 'predicate_report_qualification'
RELATIONSHIP = 'relationship'

mstrio.modeling.expression.expression module

class mstrio.modeling.expression.expression.Expression(text: Optional[str] = None, tokens: Optional[List[mstrio.modeling.expression.expression.Token]] = None, tree: Optional[mstrio.modeling.expression.expression.ExpressionNode] = None)

Bases: mstrio.utils.helper.Dictable

Class representation of Expression.

A generic specification for a calculation stored within a metadata object. The expression is represented as a tree over nodes. Most internal nodes (called operator nodes) are defined by applying a function to the operator’s child nodes.

Usually an expression must be non-empty. But in a few cases, most notably a filter expression it is valid for an expression to contain no nodes at all. An expression is empty if and only if it does not have a tree property.

Alternatively the client may prefer to handle an expression as a list of tokens. Each token represents part of the raw text of the expression, in some cases annotated with additional information.

text

Read only. Human-readable description of the expression. It is generated from the current specification of the expression.

Type

Optional[str]

tokens

Optional list, used if the expression is to be presented as a stream of tokens.

Type

Optional[List[mstrio.modeling.expression.expression.Token]]

tree

Representation of an expression as a tree of nodes, instance of one of classes inheriting from ExpressionNode class

Type

Optional[mstrio.modeling.expression.expression.ExpressionNode]

text: Optional[str] = None
tokens: Optional[List[mstrio.modeling.expression.expression.Token]] = None
tree: Optional[mstrio.modeling.expression.expression.ExpressionNode] = None
class mstrio.modeling.expression.expression.ExpressionNode(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None)

Bases: mstrio.utils.helper.Dictable

Base class representing a node of an expression tree.

dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None
dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None
static dispatch(source, connection: Optional[Connection] = None) Type[ExpressionNode]

Method dispatching node data to appropriate class that represents this type of node.

expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = 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.expression.expression.Token(value: str, type: Optional[mstrio.modeling.expression.expression.Token.Type] = None, target: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None, attribute_form: Optional[str] = None, level: Optional[mstrio.modeling.expression.expression.Token.Level] = None, state: Optional[mstrio.modeling.expression.expression.Token.State] = None)

Bases: mstrio.utils.helper.Dictable

Class representation of a single tokens of an expression.

type

Enumeration constant that classifies the text within this token

Type

Optional[mstrio.modeling.expression.expression.Token.Type]

value

The raw text represented by a token

Type

str

target

If the token represents an object, provide information about the object

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

level

Describe the amount of processing performed on this parser token

Type

Optional[mstrio.modeling.expression.expression.Token.Level]

state

Whether token is in an error or not

Type

Optional[mstrio.modeling.expression.expression.Token.State]

attribute_form

If the token represents an attribute form in the context of an object (say City@DESC) then provide attribute form id

Type

Optional[str]

class Level(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant describing the amount of processing performed on a parser token

CLIENT = 'client'
LEXED = 'lexed'
PARSED = 'parsed'
RESOLVED = 'resolved'
class State(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant describing whether token in an error or not

ERROR = 'error'
INITIAL = 'initial'
OKAY = 'okay'
class Type(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant that classifies the text within a token

BOOLEAN = 'boolean'
CHARACTER = 'character'
COLUMN_REFERENCE = 'column_reference'
DATE_TIME = 'date_time'
ELEMENTS = 'elements'
EMPTY = 'empty'
END_OF_TEXT = 'end_of_text'
ERROR = 'error'
FLOAT = 'float'
FUNCTION = 'function'
GUID = 'guid'
IDENTIFIER = 'identifier'
INTEGER = 'integer'
KEYWORD = 'keyword'
LITERAL = 'literal'
OBJECT_AT_FORM = 'object_at_form'
OBJECT_REFERENCE = 'object_reference'
OTHER = 'other'
STRING_LITERAL = 'string_literal'
UNKNOWN = 'unknown'
attribute_form: Optional[str] = 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.

Returns

An object of type T.

Return type

T

level: Optional[mstrio.modeling.expression.expression.Token.Level] = None
state: Optional[mstrio.modeling.expression.expression.Token.State] = None
target: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
to_dict(camel_case=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: Optional[mstrio.modeling.expression.expression.Token.Type] = None
value: str
mstrio.modeling.expression.expression.list_functions(connection: Connection, name: Optional[str] = None, to_dictionary: bool = False, search_pattern: Union[mstrio.object_management.search_enums.SearchPattern, int] = SearchPattern.CONTAINS, project_id: Optional[str] = None, limit: Optional[int] = None, **filters) Union[List[SchemaObjectReference], List[dict]]

Get list of SchemaObjectReference objects or dicts representing functions. Optionally filter functions by specifying ‘name’.

When attribute is: function for Operator node is set to Function.CUSTOM or Function.THIRD_PARTY, custom_function attribute is required. This function give list of SchemaObjectReference object that can be used as values for custom_function.

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

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

  • name (string, optional) – value the search pattern is set to, which will be applied to the names of functions being searched

  • to_dictionary (bool, optional) – If True returns dict, by default (False) returns SchemaObjectReference objects

  • search_pattern (SearchPattern enum or int, optional) – pattern to search for, such as Begin With or Exactly. Possible values are available in ENUM mstrio.browsing.SearchPattern. Default value is CONTAINS (4).

  • project_id (string, optional) – Project ID

  • limit (integer, optional) – limit the number of elements returned. If None all object are returned.

  • **filters

    Available filter parameters: id str: Attribute’s id name str: Attribute’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: function’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 SchemaObjectReference objects or list of dictionaries

mstrio.modeling.expression.expression_nodes module

class mstrio.modeling.expression.expression_nodes.AttributeFormPredicate(*, expression_type: typing.Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: typing.Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: typing.Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: typing.Optional[str] = None, predicate_text: typing.Optional[str] = None, function: str, attribute: mstrio.modeling.schema.helpers.SchemaObjectReference, form: mstrio.modeling.schema.helpers.SchemaObjectReference, parameters: typing.List[mstrio.modeling.expression.parameters.PredicateParameter] = <factory>, data_locale: typing.Optional[str] = None)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains an attribute form qualification predicate.

This qualification selects elements of a specified attribute by comparing the value of a specified form of the element with an expression. The comparison operator used is also specified. However, there are three options for specifying the expression with which it is compared:

  • The client may specify a literal value.

  • The client may ask to use a prompt to determine the value.

  • The client may supply an arbitrary metric style expression to evaluate to

obtain the value.

function

Specify the comparison function that should be used to compare the value computed by the filter with an expression value.

Type

str

parameters

list of objects that correspond to the parameters for the comparison function. In nearly all cases the comparison function will take one extra parameter (in addition to the parameter referenced by the predicate’s main object).

This value is a list because there are a few functions which take a different number of extra parameters. For example isNull does not need any additional parameters; notBetween needs two additional parameters.

Type

List[mstrio.modeling.expression.parameters.PredicateParameter]

attribute

The attribute whose elements are selected by this qualification

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

form

The attribute form whose value is used to specify the qualification

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

data_locale

Optional data locale used to select values of the form. The format should follow the IETF BCP 47 language tag, for example: “en-US”.

Some forms of some attributes may be configured to store representation in multiple locales. If a predicate qualifies on a form that has been translated in this manner it is likely that the elements selected by the predicate will be different for different locales. But we do not want the meaning of a filter to vary based on the locale preferences of the user executing the filter. So this property is used to specify the data locale to be used for the qualification. When set it will override the user’s personal data locale preference.

Retrieving a filter only returns this field if the form is multilingual. If the form is multilingual but no particular locale is set, an empty string will be returned. When updating or creating a filter, again a check will be made to see if the form is capable of being multilingual. If not, users inputs are ignored. If the form is indeed multilingual and the field is omitted from the input, the locale will default to the warehouse data locale of the user.

Type

Optional[str]

attribute: mstrio.modeling.schema.helpers.SchemaObjectReference
data_locale: Optional[str] = None
form: mstrio.modeling.schema.helpers.SchemaObjectReference
function: str
parameters: List[mstrio.modeling.expression.parameters.PredicateParameter]
class mstrio.modeling.expression.expression_nodes.BandingCountPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], metric: mstrio.modeling.schema.helpers.SchemaObjectReference, band_metric_function: mstrio.modeling.expression.expression_nodes.BandingPredicate.BandMetricFunction, start: mstrio.modeling.expression.parameters.Variant, stop: mstrio.modeling.expression.parameters.Variant, count: mstrio.modeling.expression.parameters.Variant, band_names: Optional[List[str]] = None)

Bases: mstrio.modeling.expression.expression_nodes.BandingPredicate

The Band count type of banding qualification slices a range of metric values into a number of equal bands that appear as rows on a report.

You define the range by setting the start at and stop at values. You also set the band count, which is the number of bands to use.

start

the start of the range

Type

mstrio.modeling.expression.parameters.Variant

stop

the end of the range

Type

mstrio.modeling.expression.parameters.Variant

count

number of bands

Type

mstrio.modeling.expression.parameters.Variant

band_names: Optional[List[str]] = None
count: mstrio.modeling.expression.parameters.Variant
start: mstrio.modeling.expression.parameters.Variant
stop: mstrio.modeling.expression.parameters.Variant
class mstrio.modeling.expression.expression_nodes.BandingDistinctPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], metric: mstrio.modeling.schema.helpers.SchemaObjectReference, band_metric_function: mstrio.modeling.expression.expression_nodes.BandingPredicate.BandMetricFunction)

Bases: mstrio.modeling.expression.expression_nodes.BandingPredicate

The Band for each distinct metric value type of banding qualification creates a separate band for each value calculated by the metric. The bands appear as rows on a report. This type of banding qualification directly uses the results of a metric as bands.

It is very useful with metrics that already contain the logic needed to calculate sequential band numbers. Such metrics use mathematical formulas, NTile functions, Band functions, or Case functions.

class mstrio.modeling.expression.expression_nodes.BandingPointsPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], metric: mstrio.modeling.schema.helpers.SchemaObjectReference, band_metric_function: mstrio.modeling.expression.expression_nodes.BandingPredicate.BandMetricFunction, points: List[float], band_names: Optional[List[str]] = None)

Bases: mstrio.modeling.expression.expression_nodes.BandingPredicate

The Banding points type of banding qualification slices a range of metric values into a number of bands that appear as rows on a report.

You manually define each band, which allows you to produce bands of varying sizes.

points

list of number used to slice metric values into bands

Type

List[float]

band_names: Optional[List[str]] = None
points: List[float]
class mstrio.modeling.expression.expression_nodes.BandingPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], metric: mstrio.modeling.schema.helpers.SchemaObjectReference, band_metric_function: mstrio.modeling.expression.expression_nodes.BandingPredicate.BandMetricFunction)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Base class for banding predicates

level

level at which the computation will be performed

Type

List[mstrio.modeling.schema.helpers.SchemaObjectReference]

metric

metric for which this banding will be applied

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

band_metric_function

function used to slice metric values into bands

Type

mstrio.modeling.expression.expression_nodes.BandingPredicate.BandMetricFunction

band_names

list of band names, a band name cannot contain “#;” or “#,”

class BandMetricFunction(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant used to specify function used to slice metric values into bands

PERCENTILE_DESCEND = 'percentile_descend'
RANK_DESCEND = 'rank_descend'
VALUE = 'value'
band_metric_function: mstrio.modeling.expression.expression_nodes.BandingPredicate.BandMetricFunction
level: List[mstrio.modeling.schema.helpers.SchemaObjectReference]
metric: mstrio.modeling.schema.helpers.SchemaObjectReference
class mstrio.modeling.expression.expression_nodes.BandingSizePredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], metric: mstrio.modeling.schema.helpers.SchemaObjectReference, band_metric_function: mstrio.modeling.expression.expression_nodes.BandingPredicate.BandMetricFunction, start: mstrio.modeling.expression.parameters.Variant, stop: mstrio.modeling.expression.parameters.Variant, size: mstrio.modeling.expression.parameters.Variant, band_names: Optional[List[str]] = None)

Bases: mstrio.modeling.expression.expression_nodes.BandingPredicate

The Band size type of banding qualification slices a range of metric values into a number of bands that appear as rows on a report.

You define the range by setting the start at and stop at values. You also set the step size, which is the size of each band.

start

the start of the range

Type

mstrio.modeling.expression.parameters.Variant

stop

the end of the range

Type

mstrio.modeling.expression.parameters.Variant

size

the size of each band

Type

mstrio.modeling.expression.parameters.Variant

band_names: Optional[List[str]] = None
size: mstrio.modeling.expression.parameters.Variant
start: mstrio.modeling.expression.parameters.Variant
stop: mstrio.modeling.expression.parameters.Variant
class mstrio.modeling.expression.expression_nodes.ColumnReference(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, column_name: str, object_id: Optional[str] = None)

Bases: mstrio.modeling.expression.expression.ExpressionNode

n expression node whose value is some column from a table implied by the expression’s context.

This kind of node is used when we wish to define an expression over the columns of a table or potentially over more than one table. The reference specifies, the column of interest, by name alone. So the reference is to a selected column on the implied table. It is not a reference to a specific column on a specific table. Defining a column reference in this manner allows the architect to specify an expression that can be usefully applied to more than one table.

column_name

The name of the column, as it appears within the RDBMS.

Type

str

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

Type

Optional[str]

column_name: str
object_id: Optional[str] = None
class mstrio.modeling.expression.expression_nodes.Constant(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, variant: Optional[mstrio.modeling.expression.parameters.Variant] = None, prompt: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None)

Bases: mstrio.modeling.expression.expression.ExpressionNode

An expression node that contains a literal value. The value was fixed when the expression node was first specified. This kind of node is only used for simple values (integers, floating point numbers and text strings).

Alternatively, instead of the variant the node could contain a choose-value prompt reference.

variant

constant value specified as Variant

Type

Optional[mstrio.modeling.expression.parameters.Variant]

prompt

reference to a prompt

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

prompt: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
variant: Optional[mstrio.modeling.expression.parameters.Variant] = None
class mstrio.modeling.expression.expression_nodes.CustomExpressionPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, expression: mstrio.modeling.expression.expression.Expression, node_property: Optional[int] = None)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains a custom expression predicate. This qualification contains a valid expression, usually created by the user, which can’t be categorized into other types.

The expression is represented by a list of tokens. The predicate has the predicate details which contains the tokens representing the expression. It’s controlled by the showPredicates to show or hide.

expression

Generic specification for calculation, instance of Expression class

Type

mstrio.modeling.expression.expression.Expression

node_property

A property used for persisting back-compatibility information for the filter editing. Usually it will not show.

Type

Optional[int]

expression: mstrio.modeling.expression.expression.Expression
node_property: Optional[int] = None
class mstrio.modeling.expression.expression_nodes.DynamicDateTime(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, value: mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeStructure)

Bases: mstrio.modeling.expression.expression.ExpressionNode

An expression node that represents Dynamic Date Time.

value

an object that represents date and/or time.

Type

DynamicDateTimeStructure

value: mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeStructure
class mstrio.modeling.expression.expression_nodes.ElementListPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, attribute: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None, elements: Optional[List[mstrio.modeling.expression.parameters.AttributeElement]] = None, elements_prompt: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None, function: mstrio.modeling.expression.expression_nodes.ElementListPredicate.ElementListFunction = ElementListFunction.IN)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains an element list predicate.

This qualification selects elements of a specified attribute by either listing the elements that should be selected, or alternatively by listing the elements that should be excluded from the selection.

attribute

The attribute whose elements are selected by this qualification. Property is not needed if the predicate uses a prompt since in that case the attribute is specified by the prompt.

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

elements

List of the elements in the predicate

Type

Optional[List[mstrio.modeling.expression.parameters.AttributeElement]]

elements_prompt

A choose-elements prompt used to obtain the elements in the qualification. If this object is used then it will specify the attribute and elements for the qualification. The prompt will specify an attribute from which the elements should be selected.

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

function

Specify the function that should be used in this predicate.

Although this property is a function identifier, there are only two functions that make sense for this predicate:

  • IN (the filter accepts any element in the list, default value)

  • NOT_IN (the filter accepts any element not included in the list)

Type

mstrio.modeling.expression.expression_nodes.ElementListPredicate.ElementListFunction

class ElementListFunction(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant that describes what functions can be used within ElementListPredicate

IN = 'in'
NOT_IN = 'not_in'
attribute: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
elements: Optional[List[mstrio.modeling.expression.parameters.AttributeElement]] = None
elements_prompt: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
function: mstrio.modeling.expression.expression_nodes.ElementListPredicate.ElementListFunction = 'in'
class mstrio.modeling.expression.expression_nodes.ExpressionFormShortcut(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, attribute: mstrio.modeling.schema.helpers.SchemaObjectReference, form: mstrio.modeling.schema.helpers.SchemaObjectReference, data_locale: Optional[str] = None)

Bases: mstrio.modeling.expression.expression.ExpressionNode

An expression node that represents shortcut to an expression form.

attribute

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.

Type

SchemaObjectReference

form

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.

Type

SchemaObjectReference

data_locale

Optional data locale used to select values of the form. The format should follow the IETF BCP 47 language tag, for example: “en-US”.

Some forms of some attributes may be configured to store representation in multiple locales. If a predicate qualifies on a form that has been translated in this manner it is likely that the elements selected by the predicate will be different for different locales. But we do not want the meaning of a filter to vary based on the locale preferences of the user executing the filter. So this property is used to specify the data locale to be used for the qualification. When set it will override the user’s personal data locale preference.

Type

str

attribute: mstrio.modeling.schema.helpers.SchemaObjectReference
data_locale: Optional[str] = None
form: mstrio.modeling.schema.helpers.SchemaObjectReference
class mstrio.modeling.expression.expression_nodes.ExpressionRelationship(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], guide: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None, is_independent: mstrio.modeling.expression.enums.IsIndependent = IsIndependent.YES, children: Optional[List[mstrio.modeling.expression.expression.ExpressionNode]] = None)

Bases: mstrio.modeling.expression.expression.ExpressionNode

An expression node that represents expression relationship.

level

Within an expression we sometimes need to state at which a computation is performed. In some cases the level is obtained by examining the execution environment. This object is used if the designer wishes to specify an explicit level.

An explicit level is a list of attributes. Alternatively the client may defer selecting an attribute (or attributes) at design time by using a prompt instead. If a prompt is used it should be a choose-attributes prompt, and it may return any number of attributes (including zero).

Type

List[mstrio.modeling.schema.helpers.SchemaObjectReference]

guide

An optional object that specifies how to relate the child filter with the output filter. There are three options, depending on the nature of the guide object:

  • The object may be a logicalTable, in which case the filter is

projected through this table.

  • The object may be a fact, in which case the filter is projected

via one of the tables on which the fact is defined.

  • There might not be a guide object at all, in which case the

filter is projected via the engine’s usual join rules (using attribute relationships from the system hierarchy).

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

is_independent

Flag that indicates whether this child filter will be considered independently of other parts of the larger filter:

  • If set to 1 (the default value, used if this property is omitted)

then this filter will be evaluated by itself.

  • If set to 0 then other parts of the larger filter will be merged

into this filter. Using this setting could change the value of a metric or relationship set qualification that appears within the child filter.

Type

mstrio.modeling.expression.enums.IsIndependent

children

List containing the optional root node of the child filter expression. We require that a relationship predicate always has a child filter is always given, but it is possible that the child filter is the empty filter. We model that situation by either omitting the children value or by using an empty list.

This expression is also a filter expression, and it is manipulated in the same manner as the rest of the filter. The predicate ids that appear within this expression must have disjoint values from the predicate ids used in the larger filter. Thus, an individual node within this expression can be manipulated by treating it as a manipulation of the larger filter in the usual manner.

We use a list so that this value matches the list value of the same name used in an operator node.

Type

Optional[List[mstrio.modeling.expression.expression.ExpressionNode]]

children: Optional[List[mstrio.modeling.expression.expression.ExpressionNode]] = None
classmethod from_dict(source: dict, connection: Connection = None, to_snake_case: bool = True) ExpressionRelationship

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.

Returns

An object of type T.

Return type

T

guide: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
is_independent: mstrio.modeling.expression.enums.IsIndependent = 1
level: List[mstrio.modeling.schema.helpers.SchemaObjectReference]
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.expression.expression_nodes.FilterQualificationPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, filter: mstrio.modeling.schema.helpers.SchemaObjectReference, is_independent: mstrio.modeling.expression.enums.IsIndependent = IsIndependent.YES)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains a filter qualification predicate.

This node is used within filter expressions to represent a predicate whose value is determined by using an external filter object. At execution time the engine will typically act as if the specified filter had been included directly. By using shared filter objects, the client can build complex filter expressions to utilise common subexpressions.

A filter object may not reference itself, or any filter that depends on itself. If such a filter is saved to the metadata any calculation that uses the filter will fail.

filter

Reference to the child filter that should be included in this predicate.

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

is_independent

Flag that indicates whether this child filter will be considered independently of other parts of the larger filter:

  • If set to 1 (the default value, used if this property is omitted)

then this filter will be evaluated by itself.

  • If set to 0 then other parts of the larger filter will be merged

into this filter. Using this setting could change the value of a metric or relationship set qualification that appears within the child filter.

Type

mstrio.modeling.expression.enums.IsIndependent

filter: mstrio.modeling.schema.helpers.SchemaObjectReference
is_independent: mstrio.modeling.expression.enums.IsIndependent = 1
class mstrio.modeling.expression.expression_nodes.JointElementListPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], tuples: List[List[mstrio.modeling.expression.parameters.AttributeElement]])

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains a joint element list predicate.

This qualification represents a filter at the level of two or more attributes. The filter is defined by simply listing the tuples of elements that satisfy the filter.

level

The level of this filter represented as a list of attributes. The attributes must be different from each other, and their order is significant.

Type

List[mstrio.modeling.schema.helpers.SchemaObjectReference]

tuples

List of tuples of elements.

Each element of this list is a joint element. That is the members of this list are themselves lists of elements. The elements in the tuples must be listed in the same order as the attributes were listed in the level list. There is no need to list the attribute on each element.

Type

List[List[mstrio.modeling.expression.parameters.AttributeElement]]

level: List[mstrio.modeling.schema.helpers.SchemaObjectReference]
tuples: List[List[mstrio.modeling.expression.parameters.AttributeElement]]
class mstrio.modeling.expression.expression_nodes.MetricPredicate(*, expression_type: typing.Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: typing.Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: typing.Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: typing.Optional[str] = None, predicate_text: typing.Optional[str] = None, function: mstrio.modeling.expression.enums.Function, metric: mstrio.modeling.schema.helpers.SchemaObjectReference, level_type: str, parameters: typing.List[mstrio.modeling.expression.parameters.PredicateParameter] = <factory>, level: typing.Optional[typing.List[mstrio.modeling.schema.helpers.SchemaObjectReference]] = None, metric_function: typing.Optional[mstrio.modeling.expression.expression_nodes.MetricPredicate.MetricFunction] = None, null_include: typing.Optional[int] = None, break_by: typing.Optional[typing.List[mstrio.modeling.schema.helpers.SchemaObjectReference]] = None, is_independent: mstrio.modeling.expression.enums.IsIndependent = IsIndependent.YES)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains a metric qualification predicate.

This qualification selects tuples of elements at a specified level by comparing the value of a specified metric evaluated at the tuple with a value of an expression. The comparison operator used is also specified. However, there are multiple options for specifying the expression with which the metric is compared:

  • The client may specify a literal value.

  • The client may specify an object reference.

  • The client may ask to use a prompt to determine the value.

  • The client may supply an arbitrary metric style expression to evaluate to obtain the value.

function

Specify the comparison function that should be used to compare the value computed by the filter with an expression value.

Type

mstrio.modeling.expression.enums.Function

metric

The metric over whose values this qualification is evaluated.

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

parameters

List of objects that correspond to the parameters for the comparison function. In nearly all cases the comparison function will take one extra parameter (in addition to the parameter referenced by the predicate’s main object).

Type

List[mstrio.modeling.expression.parameters.PredicateParameter]

level_type

Enumeration value indicating how the predicate’s level should be determined. If there is a level it is usually taken to be the same level as is used in the display grid, or which was used to obtain the data. There is also an option to specify an absolute level as part of the predicate definition.

Type

str

level

Within an expression we sometimes need to state at which a computation is performed. In some cases the level is obtained by examining the execution environment. This object is used if the designer wishes to specify an explicit level. An explicit level is a list of attributes. Alternatively the client may defer selecting an attribute (or attributes) at design time by using a prompt instead. If a prompt is used it should be a choose-attributes prompt, and it may return any number of attributes (including zero).

Type

Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]]

metric_function

Optional parameter that describes how the metric is used within the predicate. If this parameter is omitted it is treated as if it had been set to value.

Type

Optional[mstrio.modeling.expression.expression_nodes.MetricPredicate.MetricFunction]

null_include

NullInclude is an integer parameter which specifies how null values are considered when evaluating the Rank function. Use 1 to place null values after the value list, use -1 to place null values before the value list or use 0 to apply the Null checking setting for Analytical Engine in VLDB properties. If this value is not set, 0 will be applied.

Type

Optional[int]

break_by

The break by property of a metric qualification allows you to choose the attribute level at which to restart counting rank or percent values for a metric. This attribute level must be higher than or equal to the level of aggregation for the metric itself. break_by is a list of distinct attribute references. The list may also contain a choose-attribute prompt instead which can be answered with zero, one or more attributes. This value is only used when the metric_function property is not set to value.

Type

Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]]

is_independent

Flag that indicates whether the metric will be evaluated independently of other parts of the larger filter: - If set to 1 (the default value, also used if this property is

omitted) then this metric will be evaluated by itself.

  • If set to 0 then other parts of the larger filter will be applied

    when evaluating the metric.

Type

mstrio.modeling.expression.enums.IsIndependent

class MetricFunction(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant that describes how the metric is used within the predicate.

PERCENTILE_ASCEND = 'percentile_ascend'
PERCENTILE_DESCEND = 'percentile_descend'
RANK_ASCEND = 'rank_ascend'
RANK_DESCEND = 'rank_descend'
VALUE = 'value'
break_by: Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]] = None
function: mstrio.modeling.expression.enums.Function
is_independent: mstrio.modeling.expression.enums.IsIndependent = 1
level: Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]] = None
level_type: str
metric: mstrio.modeling.schema.helpers.SchemaObjectReference
metric_function: Optional[mstrio.modeling.expression.expression_nodes.MetricPredicate.MetricFunction] = None
null_include: Optional[int] = None
parameters: List[mstrio.modeling.expression.parameters.PredicateParameter]
class mstrio.modeling.expression.expression_nodes.ObjectReference(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, target: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None, is_independent: mstrio.modeling.expression.enums.IsIndependent = IsIndependent.YES, substitute_function_type: Optional[mstrio.modeling.expression.expression_nodes.ObjectReference.SubstituteFunctionType] = None)

Bases: mstrio.modeling.expression.expression.ExpressionNode

An expression node whose value is a reference to some other object in the metadata.

The meaning of the reference depends on the context. If the referenced object is an object that is based on an expression (say a filter or a metric) then it usually means we inline the expression from the object. But in other cases (say a fact) it means that on execution the object reference is replaced with a value of the fact in the context of execution.

Although unusual, it is possible that an object reference node might not refer to an object. If that happens this target property is usually omitted (but might be present but use 00000000000000000000000000000000 as its object_id).

The object could be a prompt to select the target object at runtime. Typically, it is not acceptable for the prompt to return more than one answer.

target

object being referenced

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

is_independent

Flag that indicates whether this child filter will be considered independently of other parts of the larger filter:

  • If set to 1 (the default value, used if this property is omitted)

then this filter will be evaluated by itself.

  • If set to 0 then other parts of the larger filter will be merged

into this filter. Using this setting could change the value of a metric or relationship set qualification that appears within the child filter.

Type

mstrio.modeling.expression.enums.IsIndependent

substitute_function_type

Specify how to merge multiple answers if the predicate’s value is obtained via a prompt. This property is only used when filter’s value is a prompt. If the end user selects multiple answers to the prompt, the platform will replace this node by a Boolean operator, used to combine the answers. This property determines which operator it uses. By default, it uses the parent Boolean operator (or AND if this predicate is the root of the filter). Set this property to override the default behavior.

Type

Optional[mstrio.modeling.expression.expression_nodes.ObjectReference.SubstituteFunctionType]

class SubstituteFunctionType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant that specify how to merge multiple answers if the predicate’s value is obtained via a prompt.

AND = 'and'
OR = 'or'
is_independent: mstrio.modeling.expression.enums.IsIndependent = 1
substitute_function_type: Optional[mstrio.modeling.expression.expression_nodes.ObjectReference.SubstituteFunctionType] = None
target: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
class mstrio.modeling.expression.expression_nodes.Operator(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, children: Optional[List[mstrio.modeling.expression.expression.ExpressionNode]] = None, function: Optional[mstrio.modeling.expression.enums.Function] = None, function_properties: Optional[List[mstrio.modeling.expression.parameters.FunctionProperty]] = None, function_prompt: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None, level_type: Optional[mstrio.modeling.expression.expression_nodes.Operator.LevelType] = None, level: Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]] = None, node_property: Optional[int] = None, custom_function: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None)

Bases: mstrio.modeling.expression.expression.ExpressionNode

An expression node whose value is obtained by applying a specified function to a list of child expressions. Most internal nodes within an expression are operator nodes.

children

The list of child expression that combined at this operator. If there are multiple child expressions then their order is significant. In a few cases (depending on the function) it is valid for an operator node to have no children, in which case this member property may be omitted.

Type

Optional[List[mstrio.modeling.expression.expression.ExpressionNode]]

function

Enumeration constant that identifies all the built-in functions. This value will always be provided when the service generates the object. When the client generates the object it may use this field by itself to specify the function. This value by itself is insufficient to identify the function if it is set to CUSTOM or THIRD_PARTY, in which case the custom_function value must be provided. This property is required in the predicate model but can be replaced by ‘function_prompt’ in the expression model.

Type

Optional[mstrio.modeling.expression.enums.Function]

function_properties

The list of additional properties associated with the function. This is most useful when the function is ‘RANK’, as we’ll need the “by_value” and “ascending” properties. This field is only used in a custom expression tree.

Type

Optional[List[mstrio.modeling.expression.parameters.FunctionProperty]]

function_prompt

The prompt used by this function. This field is only used in a custom expression tree.

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

level_type

Enumeration value indicating how the predicate’s level should be determined.

If there is a level it is usually taken to be the same level as is used in the display grid, or which was used to obtain the data. There is also an option to specify an absolute level as part of the predicate definition.

This field is only used in a custom expression tree.

Type

Optional[mstrio.modeling.expression.expression_nodes.Operator.LevelType]

level

This field is only used in a custom expression tree.

Type

Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]]

node_property

A property used for persisting back-compatibility information for the filter editing. Usually it will not show. If it’s displayed in the response, you should consider include it with the same value in the same node in the request body when you’re performing the PUT/POST/PATCH.

If you don’t put it back in the request, there can be some behavior difference in Filter Expression Editors of other MicroStrategy apps.

Type

Optional[int]

class LevelType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration value indicating how the predicate’s level should be determined

EXPLICIT_LEVEL = 'explicit_level'
GRID_LEVEL = 'grid_level'
METRIC_LEVEL = 'metric_level'
NONE = 'none'
children: Optional[List[mstrio.modeling.expression.expression.ExpressionNode]] = None
custom_function: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
function: Optional[mstrio.modeling.expression.enums.Function] = None
function_prompt: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
function_properties: Optional[List[mstrio.modeling.expression.parameters.FunctionProperty]] = None
level: Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]] = None
level_type: Optional[mstrio.modeling.expression.expression_nodes.Operator.LevelType] = None
node_property: Optional[int] = None
class mstrio.modeling.expression.expression_nodes.PredicateNode(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None)

Bases: mstrio.modeling.expression.expression.ExpressionNode

Base class for all predicate nodes.

predicate_id

String identifier that uniquely identifies this predicate within the context of its larger filter. Any non-empty string of printable characters can be used as a predicate.

Type

Optional[str]

predicate_text

Text representation of a predicate

Type

Optional[str]

classmethod from_dict(source: dict, connection: Optional[Connection] = None, to_snake_case: bool = True) Type[PredicateNode]

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.

Returns

An object of type T.

Return type

T

predicate_id: Optional[str] = None
predicate_text: Optional[str] = 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.expression.expression_nodes.PromptPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, prompt: mstrio.modeling.schema.helpers.SchemaObjectReference)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node for a predicate whose value is prompted at execution time.

This predicate is used for various kinds of expression prompts. At execution time the end user in effect enters an entire predicate (or an even more complex expression). The answer is then substituted into the filter in place of this node.

prompt

reference to a prompt, whose value is prompted at execution

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

prompt: mstrio.modeling.schema.helpers.SchemaObjectReference
class mstrio.modeling.expression.expression_nodes.ReportQualificationPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, report: mstrio.modeling.schema.helpers.SchemaObjectReference)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains a report qualification predicate.

This node is used within filter expressions to represent a predicate whose value is determined by using a report as filter. That is the engine will evaluate a report, and determine the rows that it covers. These filter will consist of these rows.

report

Reference to the child report that should be included in this predicate.

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

report: mstrio.modeling.schema.helpers.SchemaObjectReference
class mstrio.modeling.expression.expression_nodes.SetFromRelationshipPredicate(*, expression_type: Optional[mstrio.modeling.expression.enums.ExpressionType] = None, dimty_type: Optional[mstrio.modeling.expression.enums.DimtyType] = None, dependence_type: Optional[mstrio.modeling.expression.enums.DependenceType] = None, predicate_id: Optional[str] = None, predicate_text: Optional[str] = None, level: List[mstrio.modeling.schema.helpers.SchemaObjectReference], guide: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None, is_independent: mstrio.modeling.expression.enums.IsIndependent = IsIndependent.YES, children: Optional[List[mstrio.modeling.expression.expression.ExpressionNode]] = None)

Bases: mstrio.modeling.expression.expression_nodes.PredicateNode

Specialized expression node that contains a relationship set qualification predicate. In words this predicate describes a qualification of the form “SET of WHERE”.

This node is used within filter expressions to represent a predicate whose value is determined by starting with an arbitrary filter expression at some natural level. This filter is then projected to a filter at a level specified within this predicate by using a relationship. The relationship might be the natural relationship inferred by the engine for the schema, the relationship given by an explicit table, or a relationship implied by a fact (i.e. the engine selects the best table from the set of tables where the given fact is implemented).

This predicate is the only kind of filter predicate that may have a child expression.

level

Within an expression we sometimes need to state at which a computation is performed. In some cases the level is obtained by examining the execution environment. This object is used if the designer wishes to specify an explicit level.

An explicit level is a list of attributes. Alternatively the client may defer selecting an attribute (or attributes) at design time by using a prompt instead. If a prompt is used it should be a choose-attributes prompt, and it may return any number of attributes (including zero).

Type

List[mstrio.modeling.schema.helpers.SchemaObjectReference]

guide

An optional object that specifies how to relate the child filter with the output filter. There are three options, depending on the nature of the guide object:

The object may be a logicalTable, in which case the filter is projected through this table. The object may be a fact, in which case the filter is projected via one of the tables on which the fact is defined. There might not be a guide object at all, in which case the filter is projected via the engine’s usual join rules (using attribute relationships from the system hierarchy).

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

is_independent

Flag that indicates whether this child filter will be considered independently of other parts of the larger filter:

  • If set to 1 (the default value, used if this property is omitted)

then this filter will be evaluated by itself.

  • If set to 0 then other parts of the larger filter will be merged

into this filter. Using this setting could change the value of a metric or relationship set qualification that appears within the child filter.

Type

mstrio.modeling.expression.enums.IsIndependent

children

List containing the optional root node of the child filter expression. We require that a relationship predicate always has a child filter is always given, but it is possible that the child filter is the empty filter. We model that situation by either omitting the children value or by using an empty list.

This expression is also a filter expression, and it is manipulated in the same manner as the rest of the filter. The predicate ids that appear within this expression must have disjoint values from the predicate ids used in the larger filter. Thus, an individual node within this expression can be manipulated by treating it as a manipulation of the larger filter in the usual manner.

We use a list so that this value matches the list value of the same name used in an operator node.

Type

Optional[List[mstrio.modeling.expression.expression.ExpressionNode]]

children: Optional[List[mstrio.modeling.expression.expression.ExpressionNode]] = None
guide: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
is_independent: mstrio.modeling.expression.enums.IsIndependent = 1
level: List[mstrio.modeling.schema.helpers.SchemaObjectReference]

mstrio.modeling.expression.fact_expression module

class mstrio.modeling.expression.fact_expression.FactExpression(expression: mstrio.modeling.expression.expression.Expression, tables: List[mstrio.modeling.schema.helpers.SchemaObjectReference], id: Optional[str] = None)

Bases: mstrio.utils.helper.Dictable

Object that gives information about an expression that is in use by a fact or an attribute. Naturally the most important part of a fact expression is the expression. This is often just a single column reference, but more complex expressions are supported. The object also lists those tables where the expression is currently used or where it could be used.

We say that a table supports a fact if it is possible to compute a value for the fact by means of a SELECT expression for each row of the table. The expression represents a SELECT expression.

Parameters
  • id (str) – FactExpression’s id, a globally unique identifier used to

  • project. (distinguish between metadata objects within the same) –

  • expression (Expression) – A generic specification for a calculation

  • a (nodes at all. An expression is empty if and only if it does not have) –

  • nodes (tree over nodes. Most internal) –

  • nodes. (defined by applying a function to the operator's child) –

  • cases (Usually an expression must be non-empty. But in a few) –

  • most

  • no (notably a filter expression it is valid for an expression to contain) –

  • a

  • property. (tree) –

  • list (Alternatively the client may prefer to handle an expression as a) –

  • the (of tokens. Each token represents part of the raw text of) –

  • expression

  • information. (in some cases annotated with additional) –

  • tables (List[SchemaObjectReference]) – Array with a member object for

  • evaluating (each logical table that computes a value for this fact by) –

  • expression. (the) –

  • saved (This array should be non-empty for a fact or an attribute that is) –

  • metadata (into) –

  • of (but may be empty during an edit changeset. The order) –

  • significance. (the tables within the array has no) –

expression: mstrio.modeling.expression.expression.Expression
classmethod from_dict(source: dict, connection: Optional[Connection] = None, to_snake_case: bool = True) FactExpression

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.

Returns

An object of type T.

Return type

T

id: Optional[str] = None
local_alter(expression: Optional[mstrio.modeling.expression.expression.Expression] = None, tables: Optional[List[mstrio.modeling.schema.helpers.SchemaObjectReference]] = None)
tables: List[mstrio.modeling.schema.helpers.SchemaObjectReference]
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.expression.parameters module

class mstrio.modeling.expression.parameters.AttributeElement(display: str, element_id: str, attribute: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None)

Bases: mstrio.utils.helper.Dictable

This object represents a concrete element. A concrete element is a metadata representation of an element that exists in some data source.

Since an external data source can be modified without using the MicroStrategy Platform, the existence of a concrete element in the metadata does not mean that the element described currently exists. It means that it existed at some point.

display

Human readable string to display to describe the element to a reader

Type

str

element_id

Opaque string value that identifies the element to the service.

The client should make no assumption about the format of this string, and should not attempt to parse it (even though forms of the element are likely to be visibly concatenated into it). This string will remain valid even if the current client is using a different locale to the locale of the client that created the element.

When creating an element, the client should copy this string from other fields of the element browse result. If a “terse” element id is used, the service will need to know the attribute in order to decode the element id.

Type

str

attribute

Optionally the element may specify the attribute that it uses

Note that in most cases elements are used in a context in which the attribute value is implied (for example the element is part of an IN-list of elements for some attribute). if the attribute is implied there is no need to redundantly repeat it on each element in the collection.

Type

Optional[mstrio.modeling.schema.helpers.SchemaObjectReference]

attribute: Optional[mstrio.modeling.schema.helpers.SchemaObjectReference] = None
display: str
element_id: str
class mstrio.modeling.expression.parameters.ConstantArrayParameter(constants_type: mstrio.modeling.expression.parameters.VariantType, constants: List[str])

Bases: mstrio.modeling.expression.parameters.PredicateParameter

Object used to describe a parameter that appears in a filter predicate and whose value is a list of constants.

This kind of parameter is very specific. It is used for the IN and NOT_IN comparison functions. These functions compare one value with an array of constant values. Note that all the values in the array must have the same type.

constants_type

Identifies the type of values in constants attribute

Type

mstrio.modeling.expression.parameters.VariantType

constants

list of constant values, each of which is encoded as a string in a standard, locale-neutral representation. Their common datatype is given by constants_type.

Type

List[str]

constants: List[str]
constants_type: mstrio.modeling.expression.parameters.VariantType
class mstrio.modeling.expression.parameters.ConstantParameter(constant: mstrio.modeling.expression.parameters.Variant)

Bases: mstrio.modeling.expression.parameters.PredicateParameter

Object used to describe a parameter that appears in a filter predicate and whose value is constant.

constant

representation of constant as Variant object

Type

mstrio.modeling.expression.parameters.Variant

constant: mstrio.modeling.expression.parameters.Variant
class mstrio.modeling.expression.parameters.DynamicDateTimeParameter(dynamic_date_time: mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeStructure)

Bases: mstrio.modeling.expression.parameters.PredicateParameter

Object used to describe a parameter that appears in a filter predicate and whose value is a dynamic date/time.

dynamic_date_time

Object that represents a date/time.

Type

mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeStructure

dynamic_date_time: mstrio.modeling.expression.dynamic_date_time.DynamicDateTimeStructure
class mstrio.modeling.expression.parameters.ExpressionParameter(expression: mstrio.modeling.expression.expression.Expression)

Bases: mstrio.modeling.expression.parameters.PredicateParameter

Object used to describe a parameter that appears in a filter predicate and whose value is given as a custom expression.

This predicate parameter option is used for when the end user wants to provide a custom expression for the predicate. We would expect the parser to be used to modify the expression.

expression

custom expression, instance of Expression class

Type

mstrio.modeling.expression.expression.Expression

expression: mstrio.modeling.expression.expression.Expression
class mstrio.modeling.expression.parameters.FunctionProperty(name: str, value: mstrio.modeling.expression.parameters.Variant)

Bases: mstrio.utils.helper.Dictable

Additional properties associated with a function.

name

function’s property name

Type

str

value

function’s property value

Type

mstrio.modeling.expression.parameters.Variant

name: str
value: mstrio.modeling.expression.parameters.Variant
class mstrio.modeling.expression.parameters.ObjectReferenceParameter(target: mstrio.modeling.schema.helpers.SchemaObjectReference)

Bases: mstrio.modeling.expression.parameters.PredicateParameter

Object that describe a parameter that appears in a filter predicate and whose value is an object reference.

For example, a parameter of this type would be used by a filter predicate that compares the value of two metrics. This would be modelled by using a metric predicate (containing one of the two metrics); this parameter would then be used to record the other metric.

target

reference to object

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

target: mstrio.modeling.schema.helpers.SchemaObjectReference
class mstrio.modeling.expression.parameters.ParameterType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating type of parameter

ARRAY = 'array'
CONSTANT = 'constant'
DYNAMIC_DATE_TIME = 'dynamic_date_time'
EXPRESSION = 'expression'
OBJECT_REFERENCE = 'object_reference'
PROMPT = 'prompt'
class mstrio.modeling.expression.parameters.PredicateParameter

Bases: mstrio.utils.helper.Dictable

Base class for parameters

static dispatch(source, connection: Optional[Connection] = None) Type[PredicateParameter]
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.expression.parameters.PromptParameter(prompt: mstrio.modeling.schema.helpers.SchemaObjectReference)

Bases: mstrio.modeling.expression.parameters.PredicateParameter

Object used to describe a parameter that appears in a filter predicate and whose value will be obtained on execution by resolving a prompt object.

The prompt could be any type of prompt that returns a simple value: integer prompt, double prompt, big-decimal prompt, string prompt or date prompt. The prompt should be consistent with the data type of the value to be compared with the prompt.

prompt

reference to prompt object

Type

mstrio.modeling.schema.helpers.SchemaObjectReference

prompt: mstrio.modeling.schema.helpers.SchemaObjectReference
class mstrio.modeling.expression.parameters.Variant(type: mstrio.modeling.expression.parameters.VariantType, value: str)

Bases: mstrio.utils.helper.Dictable

The typed value used in the predicates

type

Identifies the type of value attribute

Type

mstrio.modeling.expression.parameters.VariantType

value

The value, encoded as a string in a standard, locale-neutral, format.

Type

str

type: mstrio.modeling.expression.parameters.VariantType
value: str
class mstrio.modeling.expression.parameters.VariantType(value)

Bases: mstrio.utils.enum_helper.AutoName

Enumeration constant indicating type of value of a variant object

BOOLEAN = 'boolean'
DATE = 'date'
DOUBLE = 'double'
INT32 = 'int32'
INT64 = 'int64'
STRING = 'string'
TIME = 'time'

Module contents