mstrio > server > test_center > comparison¶
- enum mstrio.server.test_center.comparison.ComparisonMethod(value)¶
Bases:
AutoNameComparison method enumeration.
Specifies how objects should be matched during comparison.
Valid values are as follows:
- BY_ID = ComparisonMethod.BY_ID¶
- BY_PATH = ComparisonMethod.BY_PATH¶
The
Enumand its members also have the following methods:- classmethod has_value(value)¶
- class mstrio.server.test_center.comparison.ComparisonTest(connection, id=None, name=None)¶
Bases:
IntegrityTestPython representation of a Strategy Comparison Test object.
- Parameters:
connection (Connection)
id (str | None)
name (str | None)
- settings¶
The comparison test settings.
- source¶
The source baseline in the comparison.
- target¶
The target baseline in the comparison.
- classmethod bulk_delete(connection, objects, force=False)¶
Delete multiple tests by their IDs.
- Parameters:
connection (Connection) – Strategy connection object returned by connection.Connection()
objects (list [str | object]) – List of test IDs or objects to be deleted.
force (bool) – If True, no additional prompt will be shown before deleting the tests.
- Returns:
bool– True if deletion was successful, 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
- classmethod create(cls, connection, name, source, target, settings=None, execute_sql=None, execute_data=None, to_dictionary=False)¶
Create a new Comparison Test.
- Parameters:
connection (object) – Strategy connection object returned by ‘connection.Connection()’.
name (str) – Name of the Comparison Test.
source (dict | BaselineTest | Baseline) – The source integrity test for the comparison. If a Baseline Test definition is provided, a new Baseline result will be generated for the test execution.
target (dict | BaselineTest | Baseline) – The target integrity test.
settings (ComparisonTestSettings, optional) – Settings for the Comparison Test. Default settings will apply for any settings that are not specified.
execute_sql (bool, optional) – Whether to include SQL content in the test. Overrides the execute_content field in settings if specified.
execute_data (bool, optional) – Whether to include data content in the test. Overrides the execute_content field in settings if specified.
to_dictionary (bool, optional) – If True, return the new Comparison Test as a dictionary instead of an object. Defaults to False.
Returns – ComparisonTest or dict: The newly created Comparison Test.
- 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 – 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 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 instance of the cls class.
- 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
- 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 Enumstrustees (
list[str|User|UserGroup] |str|User|UserGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE fordenied (
bool) – flag to indicate granted or denied access to the objectinheritable (
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 accordinglypropagation_behavior (
PropagationBehavior|str|None) – Behavior of ACL propagation to children.
- 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 Enumstrustees (
list[str|User|UserGroup] |str|User|UserGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE fordenied (
bool) – flag to indicate granted or denied access to the objectinheritable (
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 accordinglypropagation_behavior (
PropagationBehavior|str|None) – Behavior of ACL propagation to children.
- 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 Enumstrustees (
list[str|User|UserGroup] |str|User|UserGroup) – list of trustees (User or UserGroup objects or ids) to update the ACE fordenied (
bool) – flag to indicate granted or denied access to the objectinheritable (
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 accordinglypropagation_behavior (
PropagationBehavior|str|None) – Behavior of ACL propagation to children.
- 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
- Returns:
list[Translation] – A list of translations for the Object.- Return type:
list[Translation]
- alter(name=None, source=None, target=None, settings=None, execute_sql=None, execute_data=None)¶
Alter the properties of the Comparison Test.
- Parameters:
name (str) – Name of the Comparison Test.
source (dict | BaselineTest | Baseline) – The source integrity test for the comparison. If a Baseline Test definition is provided, a new Baseline result will be generated for the test execution.
target (dict | BaselineTest | Baseline) – The target integrity test.
settings (ComparisonTestSettings, optional) – Settings for the Comparison Test. Default settings will apply for any settings that are not specified.
execute_sql (bool, optional) – Whether to include SQL content in the test. Overrides the execute_content field in settings if specified.
execute_data (bool, optional) – Whether to include data content in the test. Overrides the execute_content field in settings if specified.
- alter_translation(translations)¶
Alters translations of the Object.
- Parameters:
translations (list[OperationData]) – list of translations to be added to the Object
- Return type:
None
- create_shortcut(target_folder=None, target_folder_id=None, target_folder_name=None, target_folder_path=None, project=None, project_id=None, project_name=None, to_dictionary=False)¶
Create a shortcut to the object.
- Parameters:
target_folder (Folder | tuple | list | str, optional) – Folder object or ID or name or path specifying the folder. May be used instead of target_folder_id, target_folder_name or target_folder_path.
target_folder_id (str, optional) – ID of a folder.
target_folder_name (str, optional) – Name of a folder.
target_folder_path (str, optional) –
Path of the folder. The path has to be provided in the following format:
/MicroStrategy Tutorial/Public Objects/Metrics
project (Project | str, optional) – Project object or ID or name specifying the project. May be used instead of project_id or project_name.
project_id (str, optional) – Project ID
project_name (str, optional) – Project name
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, journal_comment=None, **kwargs)¶
Delete object.
- Parameters:
force (
bool) – If True, then no additional prompt will be shown before deleting object.journal_comment (
str|None) – Comment to be added to the change journal for this deletion. If None, no comment is added.**kwargs – Any additional arguments within overridden versions of this method in inheritance chain.
- Returns:
bool– True on success. False otherwise.- Return type:
bool
- execute(target_env=None)¶
Executes the Comparison Test.
- Parameters:
target_env (Connection | Environment, optional) – Connection to the target environment or Environment object. Required for cross-environment comparisons. Target must have the same Storage Service configuration as the source environment.
- Returns:
- Object containing the result execution status
and results.
- Return type:
- 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
- fetch_all_change_journal_entries()¶
Fetch change journal entries from the API.
- Return type:
None
- get(name)¶
Get object’s attribute by its name.
- has_dependents()¶
Check if the object has any dependents.
- Returns:
bool– True if the object has dependents, False otherwise.- Return type:
bool
- 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|ACE]
Examples
>>> list_acl(deny=True, trustee_name="John")
- list_dependencies(project=None, name=None, pattern=4, domain=2, scope=None, 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).
scope (SearchScope, str, optional) – Scope of the search with regard to System Managed Objects. Possible values are available in ENUM mstrio.object_management.SearchScope.
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’]
object_types (int | ObjectTypes | ObjectSubTypes | list[int | ObjectTypes | ObjectSubTypes] | None)
- Returns:
list of objects or list of dictionaries
- list_dependents(project=None, name=None, pattern=4, domain=2, scope=None, 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).
scope (SearchScope, str, optional) – Scope of the search with regard to System Managed Objects. Possible values are available in ENUM mstrio.object_management.SearchScope.
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’]
object_types (int | ObjectTypes | ObjectSubTypes | list[int | ObjectTypes | ObjectSubTypes] | None)
- Returns:
list[dict] |list[Entity] – list of objects or list of dictionaries- Return type:
list[dict] | list[Entity]
- 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
- Returns:
list[Translation] |list[dict] – A list of dictionaries representing translations for the Object or a list of Translation Objects.- Return type:
list[Translation] | list[dict]
- 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
- 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, whitelist_keys=None, skip_private_keys=False)¶
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.
whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.
skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.
- 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
- property acl: list[ACE]¶
- property ancestors: list[dict]¶
- property certified_info¶
- property change_journal: list[ChangeJournalEntry]¶
Get change journal entries of the object.
- property comments: list[str]¶
- property connection: Connection¶
An object representation of Strategy connection specific to the object.
- property date_created: DatetimeFormats¶
- property date_modified: DatetimeFormats¶
- property ext_type: ExtendedType¶
- property folder_id: str | None¶
- property icon_path: str¶
- property id: str¶
The object’s id.
- property is_cross_environment: bool¶
Whether this Comparison Test is a cross-environment comparison.
- property location: str¶
- property owner¶
- property project_id: str¶
- property subtype: ObjectSubTypes¶
- property target_info: dict¶
- property type: ObjectTypes¶
The object’s type.
- property version: str¶
- property view_media: int¶
- class mstrio.server.test_center.comparison.ComparisonTestResult(connection, id, test_id=None)¶
Bases:
IntegrityTestResultPython representation of a Strategy Comparison Test Result object.
- Parameters:
connection (Connection)
id (str)
test_id (str | None)
- source¶
The source baseline of the comparison.
- target¶
The target baseline of the comparison.
- status¶
The running status of the comparison test.
- preparation_status¶
The preparation status of the comparison test.
- summary¶
The summary of the comparison test result.
- classmethod bulk_delete(connection, objects, force=False)¶
Delete multiple test results by their IDs.
Note
If the test results are running and not finished, deletion will fail.
- Parameters:
connection (Connection) – Strategy connection object returned by connection.Connection()
objects (list [str | object]) – List of test result IDs or objects to be deleted.
force (bool) – If True, no additional prompt will be shown before deleting the results.
- Returns:
bool– True if deletion was successful, 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
- 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 – 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 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 instance of the cls class.
- 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
- cancel_execution()¶
Cancel this instance of a test execution.
- Return type:
bool
- delete(force=False)¶
Delete this test result.
- Parameters:
force (
bool) – If True, no additional prompt will be shown before deleting the result.- Returns:
bool– True when the result was successfully deleted, False otherwise.- Return type:
bool
- export_html(location='.')¶
Export the comparison test result to an HTML summary file.
- Parameters:
location (str) – The folder path where the HTML file will be saved. Default is the running script’s current working directory.
- export_json(location='.')¶
Export the test result to JSON files.
- Parameters:
location (str) – The file path where the JSON files will be saved. Default is the running script’s current working directory.
- 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
- fetch_result_details()¶
Fetch all object result details for the test result.
- get_object_result(id, viz_key=None, to_list=False)¶
Get a specific object result by ID.
- Parameters:
id (str) – ID of the object result.
viz_key (str, optional) – Visualization key for the object result. Will be ignored if only one object result is matching.
to_list (bool, optional) – If True, return a list of matching object results, which may be empty or contain multiple entries. If False, return a single object result or raise if no such object result can be found. Defaults to False.
- Returns:
The specified object result(s).
- Return type:
ObjectBaseline | list
- 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
- print()¶
Pretty Print all properties of the object.
- 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, whitelist_keys=None, skip_private_keys=False)¶
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.
whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.
skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.
- 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
- property connection: Connection¶
An object representation of Strategy connection specific to the object.
- property date_created: DatetimeFormats¶
- property date_modified: DatetimeFormats¶
- property folder_id: str | None¶
- property id: str¶
The object’s id.
- property object_results¶
- property preparation_status¶
The preparation status of the comparison test.
- property source¶
The source baseline of the comparison.
- property status¶
The running status of the comparison test.
- property summary¶
The summary of the comparison test result.
- property target¶
The target baseline of the comparison.
- property test_id: str¶
- property type: ObjectTypes¶
The object’s type.
- class mstrio.server.test_center.comparison.ComparisonTestSettings(compare_content=None, compare_method=None)¶
Bases:
DictableSettings for configuring a Comparison Test.
- Parameters:
compare_content (list[str] | None)
compare_method (ComparisonMethod | None)
- compare_content¶
List of content types to compare: “SQL” and/or “DATA”
- compare_method¶
Method used to match objects during comparison.
- 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, whitelist_keys=None, skip_private_keys=False)¶
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.
whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.
skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.
- Returns:
- A dictionary representation of object’s attributes and values.
By default, the dictionary keys are in camel case.
- Return type:
dict
-
compare_content:
list[str] |None= None¶
-
compare_method:
ComparisonMethod|None= None¶
- class mstrio.server.test_center.comparison.ObjectComparison(connection, object_id, default_value=None, **kwargs)¶
Bases:
ObjectResult- Python representation of a per-object, per-visualization integrity
comparison result, part of a ComparisonTestResult.
- Parameters:
connection (Connection)
object_id (str)
- id¶
The ID of the object comparison.
- test_id¶
The ID of the Comparison Test that was run to generate the comparison.
- result_id¶
The ID of the Comparison Test Result that contains this object comparison.
- viz_key¶
The visualization key for the compared object.
- tested_object¶
The object (report, cube, etc.) that this result corresponds to.
- date_created¶
The date and time when the comparison was created.
- date_modified¶
The date and time when the comparison was last modified.
- sql_status¶
Status of the SQL comparison.
- data_status¶
Status of the data comparison.
- sql_diff¶
The SQL diff result for the tested object.
- data_diff¶
The data diff result for the tested object.
- 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, 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 – 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 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 instance of the cls class.
- 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
- 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
- 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
- print()¶
Pretty Print all properties of the object.
- Return type:
None
- to_dataframe()¶
Convert the comparison data to a Pandas DataFrame.
- Returns:
- A DataFrame containing the comparison data. Its shape
corresponds to the shape of source and target baselines. Each cell contains a boolean value indicating whether the corresponding data point is different between the source and target baselines.
- Return type:
pd.DataFrame
- to_dict(camel_case=True, whitelist_keys=None, skip_private_keys=False)¶
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.
whitelist_keys (list[str], optional) – List of keys to include in the resulting dictionary. If None, all keys (except hidden ones) are included. Defaults to None.
skip_private_keys (bool, optional) – If True, skips private keys in final dict representation.
- 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
- property connection: Connection¶
An object representation of Strategy connection specific to the object.
- property data_diff¶
Data diff result for this object comparison.
- property data_status: ObjectComparisonStatus | None¶
Status of the data comparison.
- property date_created: DatetimeFormats¶
- property date_modified: DatetimeFormats¶
- property export_id: str¶
- property folder_id: str | None¶
- property id: str¶
The object’s id.
- property sql_diff¶
SQL diff result for this object comparison.
- property sql_status: ObjectComparisonStatus | None¶
Status of the SQL comparison.
- property tested_object¶
- property type: ObjectTypes¶
The object’s type.
- enum mstrio.server.test_center.comparison.ObjectComparisonStatus(value)¶
Bases:
AutoNameValid values are as follows:
- MATCHED = ObjectComparisonStatus.MATCHED¶
- NOT_MATCHED = ObjectComparisonStatus.NOT_MATCHED¶
- ERROR = ObjectComparisonStatus.ERROR¶
- NOT_COMPARED = ObjectComparisonStatus.NOT_COMPARED¶
The
Enumand its members also have the following methods:- classmethod has_value(value)¶
- mstrio.server.test_center.comparison.list_comparison_test_results(connection, to_dictionary=False, to_dataframe=False, limit=None, **filters)¶
Get all Comparison Test Results stored on the configured storage.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (Connection) – Strategy connection object returned by ‘connection.Connection()’
to_dictionary (bool, optional) – if True, return Comparison Test Results as list of dicts
to_dataframe (bool, optional) – if True, return Comparison Test Results as Pandas DataFrame
limit (int, optional) – limit for the number of elements returned
**filters – Available filter parameters: [‘name’, ‘id’, ‘description’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’]
- Returns:
- List of Comparison Test Result objects in specified format
(objects, dicts, or DataFrame)
- mstrio.server.test_center.comparison.list_comparison_tests(connection, to_dictionary=False, to_dataframe=False, limit=None, **filters)¶
Get all Comparison Tests stored on the configured storage.
Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.
- Parameters:
connection (Connection) – Strategy connection object returned by ‘connection.Connection()’
to_dictionary (bool, optional) – if True, return Comparison Tests as list of dicts
to_dataframe (bool, optional) – if True, return Comparison Tests as Pandas DataFrame
limit (int, optional) – limit for the number of elements returned
**filters – Available filter parameters: [‘name’, ‘id’, ‘description’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’]
- Returns:
- List of Comparison Test objects in specified format
(objects, dicts, or DataFrame)