mstrio.modeling.schema.fact package

Submodules

mstrio.modeling.schema.fact.fact module

class mstrio.modeling.schema.fact.fact.Fact(connection: Connection, id: str | None = None, name: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE)

Bases: Entity, CopyMixin, DeleteMixin, MoveMixin, TranslationMixin

Python representation for Microstrategy Fact object.

id

fact’s ID

name

fact’s name

sub_type

string literal used to identify the type of a metadata object

description

fact’s description

type

object type, ObjectTypes enum

subtype

object subtype, ObjectSupTypes enum

ext_type

object extended type, ExtendedType enum

ancestors

list of ancestor folders

date_created

creation time, DateTime object

date_modified

last modification time DateTime object

destination_folder_id

a globally unique identifier used to distinguish between metadata objects within the same project

is_embedded

if True indicates that the target object of this reference is embedded within this object. Alternatively if this object is itself embedded, then it means that the target object is embedded in the same container as this object

data_type

dataype that the engine should use to store a intermediate values for this fact, DataType object

expressions

Array with a member object for each separately defined expression currently in use by a fact. Often a fact expression takes the form of just a single column name, but more complex expressions are possible.

entry_level

this is the natural level (in other words a set of attributes) of the fact. This property is not set by the architects. Instead it is deduced by the platform by examining the specification of the fact, and considering the attributes and the relationships between them. Because it can only be computed by considering the schema as a whole, the value is not automatically updated each time the fact is modified. It will be correct following a schema update operation.

owner

User object that is the owner

acg

access rights (see EnumDSSXMLAccessRightFlags for possible values)

acl

object access control list

version_id

the version number this object is currently carrying

hidden

Specifies whether the object is hidden

add_expression(expression: mstrio.modeling.expression.fact_expression.FactExpression | dict) None

Add expression to the fact.

Parameters:

expression (optional, object or dict) – FactExpression object or dictionary having all necessary information to be added to the fact.

alter(name: str | None = None, description: str | None = None, data_type: mstrio.modeling.schema.helpers.DataType | dict | None = None, hidden: bool | None = None, comments: str | None = None)

Alter fact properties.

Parameters:
  • name (optional, str) – fact’s name

  • description (optional, str) – fact’s description

  • data_type (optional, object or dict) – fact’s data type definition

  • hidden (bool, optional) – Specifies whether the object is hidden. Default value: False.

  • comments (optional, str) – fact’s long description

classmethod create(connection: Connection, name: str, destination_folder: mstrio.object_management.folder.Folder | str, expressions: list[mstrio.modeling.expression.fact_expression.FactExpression | dict], data_type: mstrio.modeling.schema.helpers.DataType | dict | None = None, description: str | None = None, is_embedded: bool = False, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE) Fact

Create new fact object.

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

  • name (str) – new fact’s name

  • sub_type (str, enum) – new fact’s sub_type

  • destination_folder (str or object) – A globally unique identifier or unique folder name 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.

  • expressions (list) – List of FactExpression objects or dictionaries representing the fact object.

  • data_type (object or dict) – DataType object or dict with definition of data type and precision

  • description (str) – new fact’s description

  • is_embedded (optional, bool) – True indicates that the target object of this reference is embedded within this object. Alternatively if this object is itself embedded, then it means that the target object is embedded in the same container as this object. Default value is False.

  • show_expression_as (optional, enum or str) – specify how expressions should be presented Available values: - ExpressionFormat.TREE or tree (default) - ExpressionFormat.TOKENS or tokens

Returns:

Fact class object.

get_tables(expression: mstrio.modeling.expression.fact_expression.FactExpression | str | None = None) list[mstrio.modeling.schema.helpers.SchemaObjectReference]

Get list of all tables in given fact expression. If expression argument is not specified, list all tables for fact.

Parameters:

expression (optional, str or object) – id of the fact expression or FactExpression object to get tables from.

Returns:

List of tables in given FactExpression or all tables for fact.

remove_expression(expression: str) None

Remove expression from the fact.

Parameters:

expression (str) – id of FactExpression object to be removed

mstrio.modeling.schema.fact.fact.list_facts(connection: Connection, name: str | None = None, to_dictionary: bool = False, limit: int | None = None, project_id: str | None = None, project_name: str | None = None, search_pattern: mstrio.object_management.search_enums.SearchPattern | int = SearchPattern.CONTAINS, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE, **filters) list[mstrio.modeling.schema.fact.fact.Fact] | list[dict]

Get list of Fact objects or dicts with them.

Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.

Note

When project_id is None and project_name is None, then its value is overwritten by project_id from connection object.

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

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

  • to_dictionary (optional, bool) – If True returns dictionaries, by default (False) returns Fact objects.

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

  • project_id (str, optional) – Project ID

  • project_name (str, optional) – Project name

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

  • show_expression_as (optional, enum or str) –

    specify how expressions should be presented. Available values:

    • ExpressionFormat.TREE or tree (default)

    • ExpressionFormat.TOKENS or `tokens

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’]

Returns:

list of fact objects or list of fact dictionaries.

Module contents