mstrio > server > change_journal

class mstrio.server.change_journal.ChangeJournalEntry(project_id=None, machine=None, timestamp=None, session_id=None, transaction=None, user=None, changed_links=None, changed_objects=None, timestamp_iso=None)

Bases: Dictable

Represents a single entry in the change journal.

Parameters:
  • project_id (str | None) –

  • machine (str | None) –

  • timestamp (str | None) –

  • session_id (str | None) –

  • transaction (dict | None) –

  • user (dict | None) –

  • changed_links (list[dict] | None) –

  • changed_objects (list[dict] | None) –

  • timestamp_iso (str | 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)

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

changed_objects: list[dict] | None = None
machine: str | None = None
project_id: str | None = None
session_id: str | None = None
timestamp: str | None = None
timestamp_iso: str | None = None
transaction: dict | None = None
user: dict | None = None
enum mstrio.server.change_journal.ChangeType(value)

Bases: AutoName

Enumeration of possible change types in the change journal.

Valid values are as follows:

RESERVED = ChangeType.RESERVED
CREATE_OBJECT = ChangeType.CREATE_OBJECT
CHANGE_OBJECT = ChangeType.CHANGE_OBJECT
DELETE_OBJECT = ChangeType.DELETE_OBJECT
TOUCH_FOLDER = ChangeType.TOUCH_FOLDER
CREATE_LINKITEM = ChangeType.CREATE_LINKITEM
CHANGE_LINKITEM = ChangeType.CHANGE_LINKITEM
DELETE_LINKITEM = ChangeType.DELETE_LINKITEM
CHANGE_JOURNAL_ENABLE = ChangeType.CHANGE_JOURNAL_ENABLE
CHANGE_JOURNAL_DISABLE = ChangeType.CHANGE_JOURNAL_DISABLE
CHANGE_JOURNAL_PURGE = ChangeType.CHANGE_JOURNAL_PURGE
enum mstrio.server.change_journal.TransactionType(value)

Bases: AutoName

Enumeration of possible transaction types in the change journal.

Valid values are as follows:

RESERVED = TransactionType.RESERVED
ENABLE_CHANGE_JOURNAL = TransactionType.ENABLE_CHANGE_JOURNAL
DISABLE_CHANGE_JOURNAL = TransactionType.DISABLE_CHANGE_JOURNAL
PURGE_CHANGE_JOURNAL = TransactionType.PURGE_CHANGE_JOURNAL
SAVE_OBJECT = TransactionType.SAVE_OBJECT
SAVE_OBJECTS = TransactionType.SAVE_OBJECTS
SAVE_LINKITEMS = TransactionType.SAVE_LINKITEMS
DELETE_OBJECT = TransactionType.DELETE_OBJECT
DELETE_OBJECTS = TransactionType.DELETE_OBJECTS
DELETE_PROJECT = TransactionType.DELETE_PROJECT
COPY_OBJECT = TransactionType.COPY_OBJECT
MERGE_USER = TransactionType.MERGE_USER
COLLECT_GARBAGE = TransactionType.COLLECT_GARBAGE
WRITE_SYSTEM_PROPERTY = TransactionType.WRITE_SYSTEM_PROPERTY
WRITE_DATABASE_PASSWORD = TransactionType.WRITE_DATABASE_PASSWORD
mstrio.server.change_journal.list_change_journal_entries(connection, transaction_sources=None, transaction_types=None, change_types=None, session_ids=None, machines=None, users=None, affected_projects=None, affected_objects=None, begin_transaction_id=None, end_transaction_id=None, begin_time=None, end_time=None, to_dictionary=False, limit=None)

List change journal entries based on provided filters.

Note: When listing all existing change journal entries across all projects,

this function can take a considerable amount of time to execute, depending on the volume of data.

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

  • transaction_sources (str | list[str], optional) – Transaction sources to filter by. Can be a single string or list of strings.

  • TransactionType] (transaction_types (str | TransactionType | list[str |) – optional): Transaction types to filter by. Can be a single value or list of strings or TransactionType enums.

  • transaction_types (str | TransactionType | list[str | TransactionType] | None) –

  • change_types (str | ChangeType | list[str | ChangeType] | None) –

  • session_ids (str | list[str] | None) –

  • machines (str | list[str] | None) –

  • users (str | list[str] | None) –

  • affected_projects (str | list[str] | None) –

  • affected_objects (str | Entity | list[str | Entity] | None) –

  • begin_transaction_id (int | None) –

  • end_transaction_id (int | None) –

  • begin_time (str | datetime | None) –

  • end_time (str | datetime | None) –

  • to_dictionary (bool) –

  • limit (int | None) –

Return type:

list[ChangeJournalEntry]

:paramoptional): Transaction types to filter by. Can be a single value or

list of strings or TransactionType enums.

Parameters:
  • change_types (str | ChangeType | list[str | ChangeType], optional) – Change types to filter by. Can be a single value or list of strings or ChangeType enums.

  • session_ids (str | list[str], optional) – Session IDs to filter by. Can be a single session ID or list of session IDs.

  • machines (str | list[str], optional) – Machine names to filter by. Can be a single machine name or list of machine names.

  • users (str | list[str], optional) – User IDs to filter by. Can be a single user ID or list of user IDs.

  • affected_projects (str | list[str], optional) – Project IDs/names/objects to filter by. Can be a single element or list of elements.

  • affected_objects (str | Entity | list[str | Entity], optional) – Object IDs or Entity objects to filter by. Can be a single value or list of values.

  • begin_transaction_id (int, optional) – Start of the transaction ID range to filter by.

  • end_transaction_id (int, optional) – End of the transaction ID range to filter by.

  • begin_time (str | datetime, optional) – Start of the timestamp range to filter by. Format: ‘MM/DD/YYYY HH:MM:SS AM/PM’ for string input or a datetime object.

  • end_time (str | datetime, optional) – End of the timestamp range to filter by. Format: ‘MM/DD/YYYY HH:MM:SS AM/PM’ for string input or a datetime object.

  • to_dictionary (bool, optional) – If True, returns the results as a dictionary. Defaults to False.

  • limit (int, optional) – Maximum number of entries to return. If not specified, returns all matching entries.

  • connection (Connection) –

  • transaction_sources (str | list[str] | None) –

  • transaction_types (str | TransactionType | list[str | TransactionType] | None) –

Returns:

List of ChangeJournalEntry objects matching the filters.

Return type:

list[ChangeJournalEntry]

mstrio.server.change_journal.purge_change_journal_entries(connection, projects=None, comment=None, timestamp=None)

Purge change journal entries up to a specified timestamp for given projects.

Note: If no projects are provided, all loaded projects will be targeted.

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

  • projects (str | Project | list[str | Project]) – Project(s) to purge change journal entries from. Can be a single project ID, project_name, Project object or a list of project IDs/names/objects.

  • comment (str, optional) – Comment for the purge operation.

  • timestamp (str | datetime, optional) – Timestamp up to which to purge entries. Format: ‘MM/DD/YYYY HH:MM:SS AM/PM’ for string input or a datetime object. If not provided, all entries will be purged.

Return type:

None