mstrio.modeling.filter package

Submodules

mstrio.modeling.filter.filter module

class mstrio.modeling.filter.filter.Filter(connection: Connection, id: str | None = None, name: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE, show_filter_tokens: bool = False)

Bases: Entity, CopyMixin, DeleteMixin, MoveMixin, TranslationMixin

Python representation of MicroStrategy Filter object.

name

name of the filter

id

filter ID

description

description of the filter

sub_type

string literal used to identify the type of a metadata object, ObjectSubType enum

version

object version ID

ancestors

list of ancestor folders

type

object type, ObjectTypes enum

ext_type

object extended type, ExtendedType enum

date_created

creation time, DateTime object

date_modified

last modification time, DateTime object

owner

User object that is the owner

acg

access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

object access control list

is_embedded

if true indicates that the target object of this reference is embedded within this object, if this field is omitted (as is usual) then the target is not embedded

path

the path of the object, read only

primary_locale

the primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”, read only

qualification

the filter definition written as an expression tree over predicate nodes, Filter support all kinds of predicates but bandings

destination_folder_id

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

hidden

Specifies whether the object is hidden

alter(name: str | None = None, description: str | None = None, destination_folder_id: str | None = None, qualification: mstrio.modeling.expression.expression.Expression | dict | None = None, is_embedded: bool | None = None, hidden: bool | None = None, comments: str | None = None)

Alter the filter properties.

Parameters:
  • name (str, optional) – name of a filter

  • description (str, optional) – description of a filter

  • destination_folder_id (str, optional) – a globally unique identifier used to distinguish between objects within the same project

  • qualification (Expression, dict, optional) – the filter definition written as an expression tree over predicate nodes

  • is_embedded (bool, optional) – if true indicates that the target object of this reference is embedded within this object

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

  • comments (str, optional) – long description of the filter

classmethod create(connection: Connection, name: str, destination_folder: mstrio.object_management.folder.Folder | str, qualification: mstrio.modeling.expression.expression.Expression | dict | None = None, description: str | None = None, is_embedded: bool | None = False, primary_locale: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE, show_filter_tokens: bool = False) Filter

Create a new filter in a specific project.

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

  • name (str) – name of a new filter

  • destination_folder (str or object) – a globally unique identifier or unique folder name used to distinguish between metadata objects within the same project

  • qualification (Expression or dict, optional) – new filter definition written as an expression tree over predicate nodes. It can be provided as Qualification object or dictionary.

  • description (str, optional) – optional description of a new filter

  • is_embedded (bool, optional) – if true indicates that the target object of this reference is embedded within this object

  • primary_locale (str, optional) – the primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”

  • show_expression_as (ExpressionFormat or str, optional) – specify how expressions should be presented Available values: - None (expression is returned in “text” format) - ExpressionFormat.TREE or tree (expression is returned in text and tree formats) - ExpressionFormat.TOKENS or tokens (expression is returned in text and tokens formats)

  • show_filter_tokens (bool, optional) – Specify whether “qualification” is returned in “tokens” format, along with text and tree formats. - If omitted or false, only text and tree formats are returned. - If true, all text, “tree” and tokens formats are returned.

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

Returns:

Filter object

mstrio.modeling.filter.filter.list_filters(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, show_filter_tokens: bool = False, **filters) list['Filter'] | list[dict]

Get a list of Filter objects or dicts. Optionally filter the objects by specifying filters parameter.

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 (str, optional) – value the search pattern is set to, which will be applied to the names of filters being searched

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

  • limit (int, optional) – 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 (ExpressionFormat or str, optional) – specify how expressions should be presented Available values: - None (expression is returned in “text” format) - ExpressionFormat.TREE or tree (expression is returned in text and tree formats) - ExpressionFormat.TOKENS or tokens (expression is returned in text and tokens formats)

  • show_filter_tokens (bool, optional) – Specify whether “qualification” is returned in “tokens” format, along with text and tree formats. - If omitted or false, only text and tree formats are returned. - If true, all text, tree and tokens formats are returned.

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

Returns:

list of filter objects or list of filter dictionaries.

Module contents