mstrio.modeling.schema.fact package

Submodules

mstrio.modeling.schema.fact.fact module

class mstrio.modeling.schema.fact.fact.Fact(connection: mstrio.connection.Connection, id: Optional[str] = None, name: Optional[str] = None, show_expression_as: Union[mstrio.modeling.schema.attribute.attribute.ExpressionFormat, str] = ExpressionFormat.TREE)

Bases: mstrio.utils.entity.Entity, mstrio.utils.entity.DeleteMixin, mstrio.utils.entity.CopyMixin, mstrio.utils.entity.MoveMixin

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

add_expression(expression: Union[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: Optional[str] = None, description: Optional[str] = None, data_type: Optional[Union[mstrio.modeling.schema.helpers.DataType, dict]] = 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

classmethod create(connection: mstrio.connection.Connection, name: str, destination_folder: Union[mstrio.object_management.folder.Folder, str], expressions: List[Union[mstrio.modeling.expression.fact_expression.FactExpression, dict]], data_type: Optional[Union[mstrio.modeling.schema.helpers.DataType, dict]] = None, description: Optional[str] = None, is_embedded: bool = False, show_expression_as: Union[mstrio.modeling.schema.attribute.attribute.ExpressionFormat, str] = ExpressionFormat.TREE) mstrio.modeling.schema.fact.fact.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: Optional[Union[mstrio.modeling.expression.fact_expression.FactExpression, str]] = 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: mstrio.connection.Connection, name: Optional[str] = None, to_dictionary: bool = False, limit: Optional[int] = None, project_id: Optional[str] = None, search_pattern: Union[mstrio.object_management.search_enums.SearchPattern, int] = SearchPattern.CONTAINS, show_expression_as: Union[mstrio.modeling.schema.attribute.attribute.ExpressionFormat, str] = ExpressionFormat.TREE, **filters) Union[List[mstrio.modeling.schema.fact.fact.Fact], List[dict]]

Get list of Fact objects or dicts with them.

Note

If argument project_id is not passed then project_id is taken 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

  • 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).

  • 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’, ‘description’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘icon_path’, ‘owner’]

Returns

list of fact objects or list of fact dictionaries.

Module contents