mstrio > project_objects > dashboard¶
- class mstrio.project_objects.dashboard.ChapterPage(key, visualizations, name=None, selectors=None)¶
Bases:
Dictable
Object that describes a Chapter Page
- Parameters:
key (str) –
visualizations (list[PageVisualization]) –
name (str | None) –
selectors (list[PageSelector] | None) –
- key¶
key/id of the page
- Type:
string
- visualizations¶
list of visualizations on the page
- Type:
list[PageVisualization]
- name¶
name of the page
- Type:
string, optional
- selectors¶
list of selectors on the page
- Type:
list[PageSelector], optional
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the 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 the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects 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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- list_properties(camel_case=True)¶
Lists properties of dashboard chapter page.
- Return type:
dict
- to_dict(camel_case=True)¶
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
- key: str¶
- name: str | None = None¶
- selectors: list[PageSelector] | None = None¶
- visualizations: list[PageVisualization]¶
- class mstrio.project_objects.dashboard.Dashboard(connection, name=None, id=None)¶
Bases:
Document
,RelatedSubscriptionMixin
- Parameters:
connection (Connection) –
name (str | None) –
id (str | None) –
- acl_add(rights, trustees, denied=False, inheritable=None, propagate_to_children=None, propagation_behavior=None)¶
Add Access Control Element (ACE) to the object ACL.
Note
To add rights for the Root Folder and the Freeform Objects, apply the required rights for these folders:
Root Folder: D43364C684E34A5F9B2F9AD7108F7828
Freeform Objects: 93D8CF3849C1F85DC1A48E8B9E4271F1
Argument propagate_to_children is used only for objects with type ObjectTypes.FOLDER.
- Parameters:
rights (int | Rights | AggregatedRights) – The degree to which the user or group is granted or denied access to the object. The available permissions are defined in Rights and AggregatedRights Enums
trustees (list[UserOrGroup] | UserOrGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE for
denied (bool) – flag to indicate granted or denied access to the object
inheritable (bool | None) – Applies only to folders. If set, any objects placed in the folder inherit the folder’s entry in the ACL.
propagate_to_children (bool | None) – used for folder objects only, default value is None, if set to True/False adds propagateACLToChildren keyword to the request body and sets its value accordingly
propagation_behavior (PropagationBehavior | str | None) – Behavior of ACL propagation to children.
self (Entity) –
- Return type:
None
Examples
>>> obj.acl_add(rights=Rights.BROWSE | Rights.EXECUTE, >>> trustees=user_obj, denied=True)
- acl_alter(rights, trustees, denied=False, inheritable=None, propagate_to_children=None, propagation_behavior=None)¶
Alter an existing Access Control Element (ACE) of the object ACL.
Note
To alter rights for the Root Folder and the Freeform Objects, change the required rights for these folders:
Root Folder: D43364C684E34A5F9B2F9AD7108F7828
Freeform Objects: 93D8CF3849C1F85DC1A48E8B9E4271F1
Argument propagate_to_children is used only for objects with type ObjectTypes.FOLDER.
- Parameters:
rights (int | Rights | AggregatedRights) – The degree to which the user or group is granted or denied access to the object. The available permissions are defined in Rights and AggregatedRights Enums
trustees (list[UserOrGroup] | UserOrGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE for
denied (bool) – flag to indicate granted or denied access to the object
inheritable (bool | None) – Applies only to folders. If set, any objects placed in the folder inherit the folder’s entry in the ACL.
propagate_to_children (bool | None) – used for folder objects only, default value is None, if set to True/False adds propagateACLToChildren keyword to the request body and sets its value accordingly
propagation_behavior (PropagationBehavior | str | None) – Behavior of ACL propagation to children.
self (Entity) –
- Return type:
None
Examples
>>> obj.acl_alter(rights=Rights.BROWSE | Rights.EXECUTE, >>> trustees=user_obj, denied=True)
- acl_remove(rights, trustees, denied=False, inheritable=None, propagate_to_children=None, propagation_behavior=None)¶
Remove Access Control Element (ACE) from the object ACL.
Note
To remove rights from the Root Folder and the Freeform Objects, remove them from these folders:
Root Folder: D43364C684E34A5F9B2F9AD7108F7828
Freeform Objects: 93D8CF3849C1F85DC1A48E8B9E4271F1
Argument propagate_to_children is used only for objects with type ObjectTypes.FOLDER.
- Parameters:
rights (int | Rights | AggregatedRights) – The degree to which the user or group is granted or denied access to the object. The available permissions are defined in Rights and AggregatedRights Enums
trustees (list[UserOrGroup] | UserOrGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE for
denied (bool) – flag to indicate granted or denied access to the object
inheritable (bool | None) – Applies only to folders. If set, any objects placed in the folder inherit the folder’s entry in the ACL.
propagate_to_children (bool | None) – used for folder objects only, default value is None, if set to True/False adds propagateACLToChildren keyword to the request body and sets its value accordingly
propagation_behavior (PropagationBehavior | str | None) – Behavior of ACL propagation to children.
self (Entity) –
- Return type:
None
Examples
>>> obj.acl_remove(rights=Rights.BROWSE | Rights.EXECUTE, >>> trustees=user_obj, denied=True)
- add_translation(translations)¶
Adds translations to the Object.
- Parameters:
translations (list[OperationData]) – list of translations to be added to the Object
self (Entity) –
- Returns:
A list of translations for the Object.
- Return type:
list[’Translation’]
- alter(name=None, description=None, folder_id=None, hidden=None, comments=None, owner=None)¶
Alter Dashboard’s basic properties.
- Parameters:
name (string, optional) – new name of the Dashboard
description (string, optional) – new description of the Dashboard
folder_id (string | Folder, optional) – 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.
hidden (bool, optional) – specifies whether the dashboard is hidden
comments (str, optional) – long description of the dashboard
owner (str | User | None) – (str | User, optional): owner of the dashboard
- alter_translation(translations)¶
Alters translations of the Object.
- Parameters:
translations (list[OperationData]) – list of translations to be added to the Object
self (Entity) –
- Return type:
None
- alter_vldb_settings(property_set_name, name, value, project=None)¶
Alter VLDB settings for a given property set.
- Parameters:
self (Entity) –
property_set_name (str) –
name (str) –
value (dict) –
project (str | None) –
- Return type:
None
- answer_prompts(prompt_answers, force=False)¶
Answer prompts of the report.
- Parameters:
prompt_answers (list[Prompt]) – List of Prompt class objects answering the prompts of the report.
force (bool) – If True, then the document’s existing prompt will be overwritten by ones from the prompt_answers list, and additional input from the user won’t be asked. Otherwise, the user will be asked for input if the prompt is not answered, or if prompt was already answered.
- Returns:
True if prompts were answered successfully, False otherwise.
- Return type:
bool
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the 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 the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects 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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- create_copy(name=None, folder_id=None, project=None)¶
Create a copy of the object on the I-Server.
- Parameters:
name (str | None) – New name of the object. If None, a default name is generated, such as ‘Old Name (1)’
folder_id (str | None) – ID of the destination folder. If None, the object is saved in the same folder as the source object.
project (Project | str | None) – By default, the project selected when creating Connection object. Override project to specify project where the current object exists.
self (Entity) –
- Returns:
New python object holding the copied object.
- Return type:
Any
- create_shortcut(target_folder_id=None, target_folder_path=None, target_folder=None, project_id=None, project_name=None, project=None, to_dictionary=False)¶
Create a shortcut to the object.
- Parameters:
target_folder_id (str, optional) – ID of the target folder. Target folder must be specified, but target_folder_id may be substituted with target_folder_path or target_folder.
target_folder_path (str, optional) – Path to the target folder, e.g. ‘/MicroStrategy Tutorial/Public Objects’. May be used instead of target_folder_id.
target_folder (Folder, optional) – Target folder object. May be used instead of target_folder_id.
project_id (str, optional) – ID of the target project of the new shortcut. The project may be specified by either project_id, project_name or project. If the project is not specified in either way, the project from the connection object is used.
project_name (str, optional) – Name of the target project. May be used instead of project_id.
project (Project, optional) – Project object specifying the target project. May be used instead of project_id.
to_dictionary (bool, optional) – If True, the method will return a dictionary with the shortcut’s properties instead of a Shortcut object. Defaults to False.
- Return type:
- delete(force=False)¶
Delete object.
- Parameters:
force (bool) – If True, then no additional prompt will be shown before deleting object.
self (Entity) –
- Returns:
True on success. False otherwise.
- Return type:
bool
- classmethod delete_all_caches(connection, force=None, **filters)¶
Delete all content caches filtered by the class type. Optionally filter by additional conditions.
- Parameters:
cls (object) – Class type for objects to be filtered by
connection (Connection) – Strategy One connection object returned by connection.Connection()
force (bool, optional) – If True, then no additional prompt will be shown before deleting objects.
**filters – Available filter parameters: [‘db_connection_id’, ‘db_login_id’, ‘owner’, ‘status’, ‘size’, ‘wh_tables’, ‘security_filter_id’]
- Return type:
None
- static delete_caches(connection, cache_ids, force=None)¶
Bulk delete caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – list of cache ids to be deleted
force (bool, optional) – If True, then no additional prompt will be shown before deleting objects.
- Returns:
Response object.
- Return type:
Response | None
- fetch(attr=None)¶
Fetch the latest object’s state from the I-Server.
Note
This method can overwrite local changes made to the object.
- Parameters:
attr (Optional[str]) – Attribute name to be fetched. If not specified
dictionary. (it will use all getters specified in _API_GETTERS) –
None. (Defaults to) –
- Raises:
ValueError – If attr cannot be fetched.
- Return type:
None
- static fetch_nodes(connection, project_id)¶
Fetches the nodes for the specified connection and project.
- Parameters:
connection (Connection) – Strategy One connection object returned by ‘connection.Connection()’
project_id (string) – id of the project to fetch the nodes from
- Returns:
A list of node names for the specified project.
- Return type:
list[str]
- fetch_vldb_settings()¶
- classmethod from_dict(source, connection, to_snake_case=True, with_missing_value=False)¶
- Overrides Dictable.from_dict() to instantiate an object from
a dictionary without calling any additional getters.
- 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) – A Strategy One Connection object.
to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case, default True.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- get(name)¶
Get object’s attribute by its name.
- get_connected_cubes()¶
Lists cubes used by this document.
- get_library_shortcut()¶
- Parameters:
self (Entity) –
- Return type:
- static invalidate_caches(connection, cache_ids)¶
Bulk invalidate caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – List of cache ids to be invalidated
- Returns:
Response object.
- Return type:
Response | None
- is_html_js_execution_enabled()¶
Check whether HTML and JavaScript execution is enabled for the document.
- Returns:
- True if HTML and JavaScript execution is enabled,
False otherwise.
- Return type:
bool
- Parameters:
self (Entity) –
- list_acl(to_dataframe=False, to_dictionary=False, **filters)¶
Get Access Control List (ACL) for this object. Optionally filter ACLs by specifying filters.
- Parameters:
to_dataframe (bool, optional) – if True, return datasets as pandas DataFrame
to_dictionary (bool, optional) – if True, return datasets as dicts
**filters – Available filter parameters: [deny, type, rights, trustee_id, trustee_name, trustee_type, trustee_subtype, inheritable]
- Return type:
DataFrame | list[dict | mstrio.utils.acl.ACE]
Examples
>>> list_acl(deny=True, trustee_name="John")
- list_available_schedules(to_dictionary=False, name=None, limit=None)¶
Get a list of schedules available for the object instance.
- Parameters:
to_dictionary (bool, optional) – If True returns a list of dictionaries, otherwise returns a list of Schedules. False by default.
name (str, optional) – If specified, filters the schedules to those with the specified substring in their name.
limit (int, optional) – If specified, limits the number of schedules returned.
self (Entity) –
- Returns:
List of Schedule objects or list of dictionaries.
- Return type:
list[’Schedule’] | list[dict]
- classmethod list_caches(connection, to_dictionary=False, status='ready', project_id=None, nodes=None, content_type=None, limit=None, db_connection_id=None, db_login_id=None, id=None, owner=None, size=None, wh_tables=None, security_filter_id=None)¶
List content caches. You can filter them by id, database connection (db_connection_id) and project (project_id).
You can specify from which nodes caches will be retrieved. If nodes are None then all nodes are retrieved from the cluster.
- Parameters:
connection (Connection) – Strategy One connection object returned by connection.Connection().
to_dictionary (bool, optional) – If True returns dict, by default (False) returns ContentCache objects
status (string, optional) – When provided, only caches with given status will be returned (if any). Default value ready
project_id (string, optional) – When provided only caches for project with given ID will be returned (if any).
nodes (list[string] | string, optional) – names of nodes on which caches will be searched. By default, it equals None and in that case all nodes names are loaded from the cluster.
content_type (string | CacheSource.Type, optional) – When provided, only caches of given type will be returned (if any).
limit (integer, optional) – Cut-off value for the number of objects returned. This is a local limit as we always need to fetch all caches first to allow proper filtering on mstrio-py side.
db_connection_id (string, optional) – When provided, only caches for the database connection with given ID will be returned (if any).
db_login_id (string, optional) – When provided, only caches for the database login with given ID will be returned (if any).
id (string, optional) – When provided, only cache with given ID will be returned (if any).
owner (string, optional) – Owner of the content cache. Exact match on the owner’s full name.
size (string, optional) – Size condition for the content cache (in KB). When provided, only caches which satisfy the condition will be returned (if any).
wh_tables (string, optional) – When provided, only caches using given warehouse tables will be returned (if any).
security_filter_id (string, optional) – When provided, only caches using given security filter will be returned (if any).
- Returns:
List of ContentCache objects when parameter to_dictionary is set to False (default value) or list of dictionaries otherwise.
- Return type:
list[’ContentCache’] | list[dict]
- list_dependencies(project=None, name=None, pattern=4, domain=2, object_types=None, used_by_recursive=False, root=None, root_path=None, limit=None, offset=None, results_format='LIST', to_dictionary=True, **filters)¶
List list_dependencies of an object.
- Parameters:
project (string) – Project object or ID
name (string) – Value the search pattern is set to, which will be applied to the names of object types being searched. For example, search for all report objects (type) whose name begins with (pattern) B (name).
pattern (integer or enum class object) – 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).
domain (integer or enum class object) – Domain where the search will be performed, such as Local or Project. Possible values are available in ENUM mstrio.object_management.SearchDomain. Default value is PROJECT (2).
root (string, optional) – Folder ID of the root folder where the search will be performed.
root_path (str, optional) –
Path of the root folder in which the search will be performed. Can be provided as an alternative to root parameter. If both are provided, root is used.
- the path has to be provided in the following format:
- if it’s inside of a project, example:
/MicroStrategy Tutorial/Public Objects/Metrics
- if it’s a root folder, example:
/CASTOR_SERVER_CONFIGURATION/Users
class (object_types(enum class object or integer or list of enum) – objects or integers): Type(s) of object(s) to be searched, such as Folder, Attribute or User. Possible values available in ENUMs mstrio.types.ObjectTypes and mstrio.types.ObjectSubTypes
used_by_recursive (boolean, optional) – Control the Intelligence server to also find objects that are used by the given objects indirectly. Default value is false.
results_format (SearchResultsFormat) – either a list or a tree format
to_dictionary (bool) – If False returns objects, by default (True) returns dictionaries.
limit (int) – limit the number of elements returned. If None (default), all objects are returned.
offset (int) – Starting point within the collection of returned results. Used to control paging behavior. Default is 0.
**filters – Available filter parameters: [‘id’, ‘name’, ‘description’ ,’date_created’, ‘date_modified’, ‘acg’]
self (Entity) –
object_types (TypeOrSubtype | None) –
- Returns:
list of objects or list of dictionaries
- list_dependents(project=None, name=None, pattern=4, domain=2, object_types=None, uses_recursive=False, root=None, root_path=None, limit=None, offset=None, results_format='LIST', to_dictionary=True, **filters)¶
List dependents of an object.
- Parameters:
project (string) – Project object or ID
name (string) – Value the search pattern is set to, which will be applied to the names of object types being searched. For example, search for all report objects (type) whose name begins with (pattern) B (name).
pattern (integer or enum class object) – 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).
domain (integer or enum class object) – Domain where the search will be performed, such as Local or Project. Possible values are available in ENUM mstrio.object_management.SearchDomain. Default value is PROJECT (2).
root (string, optional) – Folder ID of the root folder where the search will be performed.
root_path (str, optional) –
Path of the root folder in which the search will be performed. Can be provided as an alternative to root parameter. If both are provided, root is used.
- the path has to be provided in the following format:
- if it’s inside of a project, example:
/MicroStrategy Tutorial/Public Objects/Metrics
- if it’s a root folder, example:
/CASTOR_SERVER_CONFIGURATION/Users
class (object_types(enum class object or integer or list of enum) – objects or integers): Type(s) of object(s) to be searched, such as Folder, Attribute or User. Possible values available in ENUMs mstrio.types.ObjectTypes and mstrio.types.ObjectSubTypes
uses_recursive (boolean) – Control the Intelligence server to also find objects that use the given objects indirectly. Default value is false.
results_format (SearchResultsFormat) – either a list or a tree format
to_dictionary (bool) – If False returns objects, by default (True) returns dictionaries.
limit (int) – limit the number of elements returned. If None (default), all objects are returned.
offset (int) – Starting point within the collection of returned results. Used to control paging behavior. Default is 0.
**filters – Available filter parameters: [‘id’, ‘name’, ‘description’ ,’date_created’, ‘date_modified’, ‘acg’]
self (Entity) –
object_types (TypeOrSubtype | None) –
- Returns:
list of objects or list of dictionaries
- list_palettes(to_dictionary=False)¶
List all palettes used by this document.
- Returns:
A list of color palettes used by the document.
- Parameters:
to_dictionary (bool) –
- Return type:
list[Palette] | list[dict]
- list_properties()¶
List properties for the dashboard.
- Return type:
dict
List all subscriptions that are dependent on the object.
- list_translations(languages=None, to_dictionary=False)¶
Lists translations for the Object.
- Parameters:
languages (list, optional) –
list of languages to list the translations for, only translations from these languages will be listed. Languages in the list should be one of the following:
lcid attribute of the language
ID of the language
Language class object
to_dictionary (bool, optional) – If True returns dict, by default (False) returns Translation objects
self (Entity) –
- Returns:
A list of dictionaries representing translations for the Object or a list of Translation Objects.
- Return type:
list[’Translation’] | list[dict]
- list_vldb_settings(project=None)¶
List VLDB settings.
- Parameters:
self (Entity) –
project (str | None) –
- Return type:
list
- classmethod load_all_caches(connection, **filters)¶
Load all content caches filtered by the class type. Optionally filter by additional conditions.
- Parameters:
cls (object) – Class type for objects to be filtered by
connection (Connection) – Strategy One connection object returned by connection.Connection()
**filters – Available filter parameters: [‘db_connection_id’, ‘db_login_id’, ‘owner’, ‘status’, ‘size’, ‘wh_tables’, ‘security_filter_id’]
- Return type:
None
- static load_caches(connection, cache_ids)¶
Bulk load caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – list of cache ids to be loaded
- Returns:
Response object.
- Return type:
Response | None
- move(folder)¶
Move the object to a folder on the I-Server.
- Parameters:
folder (Folder | str) – Destination folder, specified either by id or the Folder object.
self (Entity) –
- print()¶
Pretty Print all properties of the object.
- Return type:
None
- publish(recipients=None)¶
Publish the dashboard for authenticated user. If recipients parameter is specified publishes the dashboard for the given users.
- Parameters:
recipients (UserOrGroup | list[UserOrGroup], optional) – list of users or user groups to publish the dashboard to (can be a list of IDs or a list of User and UserGroup elements)
- remove_translation(translations)¶
Removes translations from the Object.
- Parameters:
translations (list[OperationData]) – list of translations to be added to the Object
self (Entity) –
- Return type:
None
- reset_vldb_settings(project=None)¶
Reset VLDB settings to default values.
- Parameters:
self (Entity) –
project (str | None) –
- Return type:
None
- set_html_js_execution_enabled(enabled)¶
Enable or disable HTML and JavaScript execution for the document.
- Parameters:
enabled (bool) – True to enable HTML and JavaScript execution, False to disable.
self (Entity) –
- Return type:
None
Shares the dashboard to the listed users’ libraries.
- Parameters:
users (UserOrGroup | list[UserOrGroup]) – list of users or user groups to publish the dashboard to (can be a list of IDs or a list of User and UserGroup elements).
- classmethod to_csv(objects, name, path=None, properties=None)¶
Exports MSTR objects to a csv file.
Optionally, saves only the object properties specified in the properties parameter.
- Parameters:
objects (T | list[T]) – List of objects of the same type that
exported. (will be) –
name (str) – The name of the csv file ending with ‘.csv’
path (Optional[str], optional) – A path to the directory where the file will be saved. Defaults to None.
properties (Optional[list[str]], optional) – A list of object’s attribute names that should be included in the exported file. Defaults to None.
- Raises:
TypeError – If objects is not of type T or list of type T
objects. –
- Return type:
None
- to_dataframe()¶
Converts all properties of the object to a dataframe.
- Returns:
A DataFrame object containing object properties.
- Return type:
DataFrame
- to_dict(camel_case=True)¶
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
- classmethod unload_all_caches(connection, **filters)¶
Unload all content caches filtered by the class type. Optionally filter by additional conditions.
- Parameters:
cls (object) – Class type for objects to be filtered by
connection (Connection) – Strategy One connection object returned by connection.Connection()
**filters – Available filter parameters: [‘db_connection_id’, ‘db_login_id’, ‘owner’, ‘status’, ‘size’, ‘wh_tables’, ‘security_filter_id’]
- Return type:
None
- static unload_caches(connection, cache_ids)¶
Bulk unload caches.
- Parameters:
connection (Connection) – Strategy One connection object returned
'connection.Connection()' (by) –
cache_ids (list[str]) – list of cache ids to be unloaded
- Returns:
Response object.
- Return type:
Response | None
- unpublish(recipients=None)¶
Unpublish the dashboard for all users it was previously published to. If recipients parameter is specified unpublishes the dashboard for the given users.
- Parameters:
recipients (UserOrGroup | list[UserOrGroup], optional) – list of users or user groups to publish the dashboard to (can be a list of IDs or a list of User and UserGroup elements)
- update_properties()¶
Save compatible local changes of the object attributes to the I-Server. Changes are retrieved from the self._altered_properties dictionary. After the process of update has finished, self._altered_properties is cleared. For this method to work properly, you must override the _alter_properties() method in a subclass.
- Raises:
requests.HTTPError – If I-Server raises exception
- Return type:
None
- class mstrio.project_objects.dashboard.DashboardChapter(key, pages, name=None, filters=None)¶
Bases:
Dictable
Object that describes a Dashboard Chapter
- Parameters:
key (str) –
pages (list[ChapterPage]) –
name (str | None) –
filters (list[dict] | None) –
- key¶
key/id of the chapter
- Type:
string
- pages¶
list of the chapter pages
- Type:
list[ChapterPage]
- name¶
name of the chapter
- Type:
string, optional
- filters¶
(dict, optional): filters for the chapter
- Type:
list[dict] | None
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the 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 the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects 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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- list_properties(camel_case=True)¶
Lists properties of dashboard chapter.
- Return type:
dict
- to_dict(camel_case=True)¶
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
- filters: list[dict] | None = None¶
- key: str¶
- name: str | None = None¶
- pages: list[ChapterPage]¶
- class mstrio.project_objects.dashboard.PageSelector(key, selector_type, current_selection, source=None, multi_selection_allowed=False, has_all_option=False, display_style=None, available_object_items=None, targets=None, name=None, summary=None)¶
Bases:
Dictable
Object that describes a Page Selector
- Parameters:
key (str) –
selector_type (str) –
current_selection (dict) –
source (dict | None) –
multi_selection_allowed (bool) –
has_all_option (bool) –
display_style (str | None) –
available_object_items (list[dict] | None) –
targets (list[dict] | None) –
name (str | None) –
summary (str | None) –
- key¶
key/id of the selector
- Type:
string
- selector_type¶
type of the selector
- Type:
string
- current_selection¶
current selection of the selector
- Type:
dict
- source¶
source of the selector
- Type:
dict, optional
- multi_selection_allowed¶
whether multi selection is allowed, defaults to False
- Type:
bool
- has_all_option¶
whether the selector has all options enabled, defaults to False
- Type:
bool
- display_style¶
style of the selector display
- Type:
string, optional
- available_object_items¶
list of objects available for the selector
- Type:
list[dict], optional
- targets¶
list of targets of the selector
- Type:
list[dict], optional
- name¶
name of the selector
- Type:
string, optional
- summary¶
summary of the selector
- Type:
string, optional
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the 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 the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects 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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- list_properties(camel_case=True)¶
Lists properties of page selector.
- Return type:
dict
- to_dict(camel_case=True)¶
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
- available_object_items: list[dict] | None = None¶
- current_selection: dict¶
- display_style: str | None = None¶
- has_all_option: bool = False¶
- key: str¶
- multi_selection_allowed: bool = False¶
- name: str | None = None¶
- selector_type: str¶
- source: dict | None = None¶
- summary: str | None = None¶
- targets: list[dict] | None = None¶
- class mstrio.project_objects.dashboard.PageVisualization(key, visualization_type=None, name=None, selector=None)¶
Bases:
Dictable
Object that describes a Visualization on a Page
- Parameters:
key (str) –
visualization_type (str | None) –
name (str | None) –
selector (VisualizationSelector | None) –
- key¶
key/id of the visualization
- Type:
string
- visualization_type¶
type of the visualization
- Type:
string, optional
- name¶
name of the visualization
- Type:
string, optional
- selector¶
selector for the visualization
- Type:
VisualizationSelector, optional
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the 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 the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects 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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- list_properties(camel_case=True)¶
Lists properties of page visualization.
- Return type:
dict
- to_dict(camel_case=True)¶
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
- key: str¶
- name: str | None = None¶
- selector: VisualizationSelector | None = None¶
- visualization_type: str | None = None¶
- class mstrio.project_objects.dashboard.VisualizationSelector(visualization_key, selector_type, current_selection, targets=None)¶
Bases:
Dictable
Object that describes a Visualization Selector
- Parameters:
visualization_key (str) –
selector_type (str) –
current_selection (dict) –
targets (list[dict] | None) –
- visualization_key¶
key/id of the selector
- Type:
string
- selector_type¶
type of the selector
- Type:
string
- current_selection¶
current selection of the selector
- Type:
dict
- targets¶
list of the selector’s targets
- Type:
list[dict], optional
- classmethod bulk_from_dict(source_list, connection=None, to_snake_case=True, with_missing_value=False)¶
Creates multiple objects from a list of dictionaries. For each dictionary provided the 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 the object’s _FROM_DICT_MAP.
- Parameters:
cls (T) – Class (type) of the objects that should be created.
source_list (List[Dict[str, Any]]) – A list of dictionaries from which the objects 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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
A list of objects of type T.
- Return type:
T
- classmethod from_dict(source, connection=None, to_snake_case=True, with_missing_value=False)¶
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.
with_missing_value (bool) – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.
- Returns:
An object of type T.
- Return type:
T
- list_properties(camel_case=True)¶
Lists properties of visualization selector.
- Return type:
dict
- to_dict(camel_case=True)¶
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
- current_selection: dict¶
- selector_type: str¶
- targets: list[dict] | None = None¶
- visualization_key: str¶
- mstrio.project_objects.dashboard.list_dashboards(connection, name=None, to_dictionary=False, to_dataframe=False, limit=None, project_id=None, project_name=None, **filters)¶
Get all Dashboards stored on the server.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (object) – Strategy One connection object returned by ‘connection.Connection()’
name (str | None) – characters that the dashboard name must contain
to_dictionary (bool, optional) – if True, return Dashboards as list of dicts
to_dataframe (bool, optional) – if True, return Dashboards as pandas DataFrame
limit (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
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’, ‘view_media’, ‘certified_info’, ‘project_id’]
- Returns:
List of dashboards or list of dictionaries or DataFrame object
- Return type:
list[Dashboard] | list[dict] | DataFrame
- mstrio.project_objects.dashboard.list_dashboards_across_projects(connection, name=None, to_dictionary=False, to_dataframe=False, limit=None, **filters)¶
Get all Dashboards stored on the server.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (object) – Strategy One connection object returned by ‘connection.Connection()’
name (str | None) – characters that the dashboard name must contain
to_dictionary (bool, optional) – if True, return Dashboards as list of dicts
to_dataframe (bool, optional) – if True, return Dashboards as pandas DataFrame
limit (int | None) – limit the number of elements returned. If None (default), all objects are returned.
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’, ‘view_media’, ‘certified_info’, ‘project_id’]
- Returns:
List of dashboards or list of dictionaries or DataFrame object
- Return type:
list[Dashboard] | list[dict] | DataFrame