mstrio.modeling.schema.transformation package

Submodules

mstrio.modeling.schema.transformation.transformation module

class mstrio.modeling.schema.transformation.transformation.MappingType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

Enumeration constants used to specify mapping type

MANY_TO_MANY = 'many_to_many'
ONE_TO_ONE = 'one_to_one'
class mstrio.modeling.schema.transformation.transformation.Transformation(connection: Connection, id=None, name=None, show_expression_as=ExpressionFormat.TREE)

Bases: Entity, MoveMixin, DeleteMixin, TranslationMixin

Python representation of MicroStrategy Transformation object.

id

transformation’s ID

name

transformation’s name

sub_type

string literal used to identify the type of a metadata object

description

transformation’s description

type

object type, ObjectTypes enum

subtype

object subtype, ObjectSubTypes enum

ext_type

object extended type, ExtendedType enum

attributes

list of attributes used in the transformation

date_created

creation time, DateTime object

date_modified

last modification time, DateTime object

mapping_type

transformation’s mapping type, MappingType enum

owner

User object that is the owner

version_id

the version number this object is currently carrying

primary_locale

The primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”.If no particular locale is set as the primary locale (for example, if the project is not internationalized), the field will be omitted.

acg

access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

object access control list

hidden

Specifies whether the object is hidden

alter(name: str | None = None, destination_folder_id: mstrio.object_management.folder.Folder | str | None = None, attributes: list | None = None, mapping_type: mstrio.modeling.schema.transformation.transformation.MappingType | None = None, description: str | None = None, hidden: bool | None = None, comments: str | None = None)

Alter transformation properties.

Parameters:
  • name – transformation’s name

  • destination_folder_id – A globally unique identifier used to distinguish between metadata objects within the same project. It is possible for two metadata objects in different projects to have the same Object Id.

  • attributes – list of base transformation attributes

  • mapping_type – transformation’s mapping type

  • description – transformation’s description

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

  • comments – long description of the transformation

classmethod create(connection: Connection, sub_type: mstrio.modeling.schema.helpers.ObjectSubType | str, name: str, destination_folder: mstrio.object_management.folder.Folder | str, attributes: list, mapping_type: mstrio.modeling.schema.transformation.transformation.MappingType | str, is_embedded: bool = False, description: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE) Transformation

Create Transformation object.

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

  • sub_type – transformation’s sub_type

  • name – transformation’s name

  • destination_folder – A globally unique identifier used to distinguish between metadata objects within the same project. It is possible for two metadata objects in different projects to have the same Object Id.

  • attributes – list of base transformation attributes

  • mapping_type – transformation’s mapping type

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

  • description – transformation’s description

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

Returns:

Transformation class object.

list_properties()

Fetches all attributes from the server and converts all properties of the object to a dictionary.

Parameters:

excluded_properties (list[str], optional) – A list of object properties that should be excluded from the dict. Defaults to None.

Returns:

A dictionary which keys are object’s attribute names, and

which values are object’s attribute values.

Return type:

dict

class mstrio.modeling.schema.transformation.transformation.TransformationAttribute(id: str, base_attribute: SchemaObjectReference, forms: list[mstrio.modeling.schema.transformation.transformation.TransformationAttributeForm])

Bases: Dictable

Class representation of Transformation Attribute

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:

str

base_attribute

Object that specifies the base attribute of the transformation attribute.

Type:

mstrio.modeling.schema.helpers.SchemaObjectReference

forms

Object that specifies the transformation attribute form.

Type:

list[mstrio.modeling.schema.transformation.transformation.TransformationAttributeForm]

base_attribute: SchemaObjectReference
forms: list[mstrio.modeling.schema.transformation.transformation.TransformationAttributeForm]
id: str
list_properties(camel_case=True) dict

Lists all properties of transformation attribute.

class mstrio.modeling.schema.transformation.transformation.TransformationAttributeForm(id: str, name: str, lookup_table: SchemaObjectReference, expression: Expression)

Bases: Dictable

Class representation of Transformation Attribute Form

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:

str

name

transformation attribute form name

Type:

str

lookup_table

schema reference of a lookup table

Type:

mstrio.modeling.schema.helpers.SchemaObjectReference

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.

Type:

mstrio.modeling.expression.expression.Expression

expression: Expression
id: str
list_properties(camel_case=True) dict

Lists all properties of transformation attribute form.

lookup_table: SchemaObjectReference
name: str
mstrio.modeling.schema.transformation.transformation.list_transformations(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.transformation.transformation.Transformation] | list[dict]

Get list of Transformation objects or dicts with them.

Optionally use to_dictionary to choose output format. Optionally filter transformations by specifying ‘name’.

Wildcards available for ‘name’:

? - any character * - 0 or more of any characters e.g. name_begins = ?onny will return Sonny and Tonny

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

Note

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

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

  • name (string, optional) – characters that the transformation name must begin with

  • to_dictionary (bool, optional) – If True returns dict, by default (False) returns Transformation object

  • limit (integer, optional) – limit the number of elements returned. If None 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 (ExpressionFormat, str) –

    specify how expressions should be presented Available values:

    • ExpressionFormat.TREE or tree (default)

    • ExpressionFormat.TOKENS or `tokens

  • **filters

    Available filter parameters: id str: Transformation’s ID name str: Transformation’s name description str: Transformation’s description date_created str: format: 2001-01-02T20:48:05.000+0000 date_modified str: format: 2001-01-02T20:48:05.000+0000 version str: Transformation’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 subtype str: object’s subtype ext_type str: object’s extended type

Returns:

list with Transformation objects or list of dictionaries

Module contents