mstrio > object_management > search_operations¶
- class mstrio.object_management.search_operations.DateQuery(begin_date=None, end_date=None, since_days=None, since_months=None)¶
Bases:
Dictable
Object that specifies a date query for searches: either a date range or number of days or months before the current date.
- Parameters:
begin_date (date | str | None) –
end_date (date | str | None) –
since_days (int | None) –
since_months (int | None) –
- begin_date¶
Start date of the range.
- Type:
date | None
- end_date¶
End date of the range. begin_date and end_date must be provided together. They must be the only parameters provided if used.
- Type:
date | None
- since_days¶
Number of days before the current date. Must be the only parameter provided if used.
- Type:
int | None
- since_months¶
Number of months before the current date. Must be the only parameter provided if used.
- Type:
int | 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
- to_dict(camel_case=True)¶
Convert DateQuery object to a dictionary.
- Parameters:
camel_case (bool) – If True, returns keys in camelCase format, otherwise returns keys in snake_case format.
- Returns:
Dictionary representation of the DateQuery object.
- Return type:
dict
- class mstrio.object_management.search_operations.QuickSearchData(project_id, object_ids)¶
Bases:
Dictable
Object that specifies a search criteria for quick search. .. attribute:: project_id
Project ID
- type:
str
- Parameters:
project_id (str) –
object_ids (list[str]) –
- object_ids¶
List of object IDs
- Type:
list[str]
- 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
- 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
- object_ids: list[str]¶
- project_id: str¶
- class mstrio.object_management.search_operations.SearchObject(connection, id)¶
Bases:
Entity
,CopyMixin
,MoveMixin
,DeleteMixin
Search object describing criteria that specify a search for objects.
- Parameters:
connection (Connection) –
id (str) –
- connection¶
A Strategy One connection object
- id¶
Object ID
- name¶
Object name
- description¶
Object description
- abbreviation¶
Object abbreviation
- type¶
Object type
- subtype¶
Object subtype
- ext_type¶
Object extended type
- date_created¶
Creation time, DateTime object
- date_modified¶
Last modification time, DateTime object
- version¶
Version ID
- owner¶
Owner ID and name
- icon_path¶
Object icon path
- view_media¶
View media settings
- ancestors¶
List of ancestor folders
- acg¶
Access rights (See EnumDSSXMLAccessRightFlags for possible values)
- acl¶
Object access control list
- 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_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
- 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
- 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
- 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.
- 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_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_properties(excluded_properties=None)¶
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
- 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]
- 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
- 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
- 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
- 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
- mstrio.object_management.search_operations.find_objects_with_id(connection, object_id, projects=None, to_dictionary=False)¶
Find object by its ID only, without knowing project ID and object type. The search is performed by iterating over projects and trying to retrieve the objects with different type.
- Limitation:
- Only object types supported by mstrio, i.g. present in
mstrio.types.ObjecTypes enum, are used.
Configuration object are also not searched.
- Parameters:
connection (Connection) – Strategy One connection object returned by connection.Connection().
object_id (str) – ID of an object.
projects (list[Project] | list[str], optional) – List of projects where to perform the search. By default, if no project are provides, the search is performed on all loaded projects.
to_dictionary (bool, optional) – If True returns dicts, by default (False) returns objects.
- Returns:
- {
‘project_id’: <str>, ‘object_data’: <dict or object>
}
- Return type:
Returns list of dict with the following structure
- mstrio.object_management.search_operations.full_search(connection, project=None, name=None, pattern=SearchPattern.CONTAINS, domain=SearchDomain.PROJECT, root=None, root_path=None, object_types=None, uses_object_id=None, uses_object_type=None, uses_recursive=False, uses_one_of=False, used_by_object_id=None, used_by_object_type=None, used_by_recursive=False, used_by_one_of=False, begin_modification_time=None, end_modification_time=None, results_format=SearchResultsFormat.LIST, limit=None, offset=None, to_dictionary=True, **filters)¶
Perform a full metadata search and return results.
Note
If you have a large number of objects in your environment, try to use limit and offset parameters to retrieve the results in batches.
- Parameters:
connection (object) – Strategy One connection object returned by connection.Connection()
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
objects (object_types(enum class object or integer or list of enum class) – 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_object_id (string) – Constrain the search to only return objects which use the given object.
uses_object_type (string) – Constrain the search to only return objects which use the given object. Possible values available in ENUMs mstrio.types.ObjectTypes
uses_recursive (boolean) – Control the Intelligence server to also find objects that use the given objects indirectly. Default value is false.
uses_one_of (boolean) – Control the Intelligence server to also find objects that use one of or all of given objects indirectly. Default value is false.
used_by_object_id (string) – Constrain the search to only return objects which are used by the given object.
used_by_object_type (string) – Constrain the search to only return objects which are used by the given object. Possible values available in ENUM mstrio.types.ObjectTypes
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.
used_by_one_of (boolean) – Control the Intelligence server to also find objects that are used by one of or all of given objects indirectly. Default value is false.
begin_modification_time (string, optional) – Field to filter request to return records newer than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2021-04-04T06:33:32Z.
end_modification_time (string, optional) – Field to filter request to return records older than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2022-04-04T06:33:32Z.
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’]
object_types (TypeOrSubtype | None) –
- Returns:
list of objects or list of dictionaries
- Return type:
list[dict] | list[mstrio.utils.entity.Entity]
- mstrio.object_management.search_operations.get_search_results(connection, search_id, project=None, results_format=SearchResultsFormat.LIST, limit=None, offset=None, to_dictionary=False, **filters)¶
Retrieve the results of a full metadata search previously stored in an instance in IServer memory, may be obtained by start_full_search.
Note
If you have a large number of objects in your environment, try to use limit and offset parameters to retrieve the results in batches.
- Parameters:
connection (object) – Strategy One connection object returned by connection.Connection()
search_id (str) – Search ID (identifies the results of a previous search stored in IServer memory)
project (string) – Project object or ID
results_format (SearchResultsFormat) – either a list or a tree format
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
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’]
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.search_operations.get_search_suggestions(connection, project=None, key=None, max_results=4, cross_cluster=None)¶
Request search suggestions from the server.
- Parameters:
connection (object) – Strategy One REST API connection object
project (string, optional) – Project object or ID
key (string, optional) – value the search pattern is set to, which will be applied to the names of suggestions being searched
max_results (int, optional) – maximum number of items returned for a single request. Used to control paging behavior. Default value is -1 for no limit.
cross_cluster (bool, optional) – perform search in all unique projects across the cluster, this parameter only takes effect for I-Server with cluster nodes. Default value is None
- Returns:
list of search suggestions
- Return type:
list[str]
- mstrio.object_management.search_operations.quick_search(connection, project=None, name=None, root=None, root_path=None, pattern=SearchPattern.CONTAINS, object_types=None, get_ancestors=False, cross_cluster=False, hidden=None, certified_status=CertifiedStatus.ALL, limit=None, offset=None, to_dictionary=True)¶
- Use the stored results of the Quick Search engine to return
search results and display them as a list. The Quick Search engine periodically indexes the metadata and stores the results in memory, making Quick Search very fast but with results that may not be the most recent.
- Parameters:
connection (object) – Strategy One connection object returned by connection.Connection()
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).
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
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).
objects (object_types(enum class object or integer or list of enum class) – 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
get_ancestors (bool) – Specifies whether to return the list of ancestors for each object
certified_status (CertifiedStatus) – Defines a search criteria based on the certified status of the object, possible values available in CertifiedStatus enum
cross_cluster (bool) – Perform search in all unique projects across the cluster,this parameter only takes affect for I-Server with cluster nodes.
hidden (bool) – Filter the result based on the ‘hidden’ field of objects. If not passed, no filtering is applied.
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.
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
object_types (TypeOrSubtype | None) –
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.search_operations.quick_search_by_id(connection, search_data, to_dictionary=False, **filters)¶
Perform a quick search based on a project IDs and object IDs.
- Parameters:
connection (object) – Strategy One connection object returned by connection.Connection()
search_data (QuickSearchData | list[QuickSearchData]) – search data
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
**filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’, ‘project_id’]
- Return type:
list[dict | type[mstrio.utils.entity.Entity]]
- mstrio.object_management.search_operations.quick_search_from_object(connection, project, search_object, include_ancestors=False, include_acl=False, subtypes=None, limit=None, offset=None, to_dictionary=True)¶
Perform a quick search based on a predefined Search Object. Use an existing search object for Quick Search engine to return search results and display them as a list.
- Parameters:
connection (object) – Strategy One connection object returned by connection.Connection()
project (string) – Project object or ID
search_object (SearchObject) – Search object ID to retrieve result from
include_ancestors (bool) – Specifies whether to return the list of ancestors for each object
include_acl (bool) – Specifies whether to return the list of ACL for each object
subtypes (list, int) – This parameter is used to filter the objects in the result to include only the ones whose “subtype” is included in the values of this parameter
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.
to_dictionary (bool) – If True returns dicts, by default (False) returns objects.
- Returns:
list of objects or list of dictionaries
- mstrio.object_management.search_operations.start_full_search(connection, project=None, name=None, object_types=None, pattern=SearchPattern.CONTAINS, domain=SearchDomain.PROJECT, root=None, root_path=None, uses_object_id=None, uses_object_type=None, uses_recursive=False, uses_one_of=False, used_by_object_id=None, used_by_object_type=None, used_by_recursive=False, used_by_one_of=False, begin_modification_time=None, end_modification_time=None)¶
Search the metadata for objects in a specific project that match specific search criteria, and save the results in IServer memory.
- Parameters:
connection (object) – Strategy One connection object returned by connection.Connection()
project (string) – Project object or ID
objects (object_types(enum class object or integer or list of enum class) – 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
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
uses_object_id (string) – Constrain the search to only return objects which use the given object.
uses_object_type (int, ObjectTypes) – Constrain the search to only return objects which use the given object. Possible values available in ENUMs mstrio.types.ObjectTypes
uses_recursive (boolean) – Control the Intelligence server to also find objects that use the given objects indirectly. Default value is false.
uses_one_of (boolean) – Control the Intelligence server to also find objects that use one of or all of given objects indirectly. Default value is false.
used_by_object_id (string) – Constrain the search to only return objects which are used by the given object.
used_by_object_type (int, ObjectTypes) – Constrain the search to only return objects which are used by the given object. Possible values available in ENUM mstrio.types.ObjectTypes
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.
used_by_one_of (boolean) – Control the Intelligence server to also find objects that are used by one or all given objects indirectly. Default value is false.
begin_modification_time (string, optional) – Field to filter request to return records newer than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2021-04-04T06:33:32Z.
end_modification_time (string, optional) – Field to filter request to return records older than a given date in format ‘yyyy-MM-dd’T’HH:mm:ssZ’, for example 2022-04-04T06:33:32Z.
object_types (TypeOrSubtype | None) –
- Returns:
dictionary consisting of id (Search ID) and total items number
- Return type:
dict