mstrio.distribution_services.schedule package

Submodules

mstrio.distribution_services.schedule.schedule module

class mstrio.distribution_services.schedule.schedule.Schedule(connection: Connection, id: str = None, name: str = None)

Bases: Entity, DeleteMixin

Class representation of MicroStrategy Schedule object.

connection

A MicroStrategy connection object

name

Schedule name

id

Schedule ID

description

Schedule description

schedule_type

Schedule type

schedule_next_delivery

Schedule next delivery date

time

Details of time-based schedule

Type:

ScheduleTime

event

Details of event-based schedule

Type:

Event

class ScheduleType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

Class representation of a type of a Microstrategy Schedule.

EVENT_BASED = 'event_based'
NONE = None
TIME_BASED = 'time_based'
alter(name: Optional[str] = None, description: Optional[str] = None, start_date: Optional[Union[str, datetime]] = None, stop_date: Optional[Union[str, datetime]] = None, event: Optional[Event] = None, event_id: Optional[str] = None, time: Optional[ScheduleTime] = None, recurrence_pattern: Optional[RecurrencePattern] = None, execution_pattern: Optional[ExecutionPattern] = None, execution_time: Optional[str] = None, start_time: Optional[str] = None, stop_time: Optional[str] = None, execution_repeat_interval: Optional[int] = None, daily_pattern: Optional[DailyPattern] = None, repeat_interval: Optional[int] = None, days_of_week: Optional[list[mstrio.distribution_services.schedule.schedule_time.ScheduleEnums.DaysOfWeek]] = None, day: Optional[int] = None, month: Optional[int] = None, week_offset: Optional[WeekOffset] = None, day_of_week: Optional[DaysOfWeek] = None, weekday_offset: Optional[str] = None, days_of_month: Optional[list[str]] = None, monthly_pattern: Optional[MonthlyPattern] = None, yearly_pattern: Optional[YearlyPattern] = None) None

Alter Schedule properties.

Parameters:
  • recurrence_pattern (ScheduleEnums.RecurrencePattern, optional) – The recurrence pattern of the schedule. Possible values are DAILY, WEEKLY, MONTHLY, YEARLY. Defaults to None.

  • execution_pattern (ScheduleEnums.ExecutionPattern, optional) – The execution pattern of the schedule. Possible values are ONCE, REPEAT. Defaults to None.

  • execution_time (str, optional) – The execution time of the execution day, if execution_pattern is ONCE. Format should be HH:mm:ss. Defaults to None.

  • start_time (str, optional) – The start time of the execution day, if execution_pattern is REPEAT. Format should be HH:mm:ss. Defaults to None.

  • stop_time (str, optional) – The stop time of the execution day, if execution_pattern is REPEAT. Format should be HH:mm:ss. Defaults to None.

  • execution_repeat_interval (int, optional) – The repeat interval of minutes of the execution day, if execution_pattern is REPEAT. Defaults to None.

  • daily_pattern (ScheduleEnums.DailyPattern, optional) – The daily recurrence pattern of the schedule. Possible values are DAY, WEEKDAY. Defaults to None.

  • repeat_interval (int, optional) – The repeat interval of days of daily schedule, if daily_pattern is DAY. Defaults to None.

  • day (int, optional) – The day in month of monthly schedule, if monthly_pattern is DAY or, The day in month of yearly schedule, if yearly_pattern is DAY. Defaults to None.

  • month (int, optional) – The month in year of yearly schedule. Defaults to None.

  • week_offset (ScheduleEnums.WeekOffset, optional) – The week offset in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The week offset in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are FIRST, SECOND, THIRD, FOURTH, LAST. Defaults to None.

  • day_of_week (ScheduleEnums.DaysOfWeek, optional) – The days of week of weekly schedule or, The day of week in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The day of week in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. Defaults to None.

  • weekday_offset (ScheduleEnums.WeekdayOffset, optional) – The weekday offset in month of monthly schedule, if monthly_pattern is WEEKDAY. Defaults to None.

  • days_of_month (List[str], optional) – The days of month of monthly schedule, if monthly_pattern is DAYS_OF_MONTH. Must be provided as a list of one or more stringified digits (from ‘1’ to ‘31’). Defaults to None.

  • monthly_pattern (ScheduleEnums.MonthlyPattern, optional) – The monthly recurrence pattern of the schedule. Possible values are: DAY, DAY_OF_WEEK, WEEKDAY, LAST_DAY, DAYS_OF_MONTH. Defaults to None.

  • yearly_pattern (ScheduleEnums.YearlyPattern, optional) – The yearly recurrence pattern of the schedule. Possible values are DAY, DAY_OF_WEEK. Defaults to None.

Returns:

None

classmethod create(connection: Connection, name: str, schedule_type: mstrio.distribution_services.schedule.schedule.Schedule.ScheduleType | str, start_date: str | datetime.datetime, description: Optional[str] = None, stop_date: Optional[Union[str, datetime]] = None, event_id: Optional[str] = None, time: Optional[ScheduleTime] = None, recurrence_pattern: Optional[Union[RecurrencePattern, str]] = None, execution_pattern: Optional[Union[ExecutionPattern, str]] = None, execution_time: Optional[str] = None, start_time: Optional[str] = None, stop_time: Optional[str] = None, execution_repeat_interval: Optional[int] = None, daily_pattern: Optional[Union[DailyPattern, str]] = None, repeat_interval: Optional[int] = None, days_of_week: Optional[Union[list[mstrio.distribution_services.schedule.schedule_time.ScheduleEnums.DaysOfWeek], list[str]]] = None, day: Optional[int] = None, month: Optional[int] = None, week_offset: Optional[Union[WeekOffset, str]] = None, day_of_week: Optional[Union[DaysOfWeek, str]] = None, weekday_off_set: Optional[str] = None, days_of_month: Optional[list[str]] = None, monthly_pattern: Optional[Union[MonthlyPattern, str]] = None, yearly_pattern: Optional[Union[YearlyPattern, str]] = None)

Create a Schedule using provided parameters as data.

Parameters:
  • recurrence_pattern (ScheduleEnums.RecurrencePattern, optional) – The recurrence pattern of the schedule. Possible values are DAILY, WEEKLY, MONTHLY, YEARLY. Defaults to None.

  • execution_pattern (ScheduleEnums.ExecutionPattern, optional) – The execution pattern of the schedule. Possible values are ONCE, REPEAT. Defaults to None.

  • execution_time (str, optional) – The execution time of the execution day, if execution_pattern is ONCE. Format should be HH:mm:ss. Defaults to None.

  • start_time (str, optional) – The start time of the execution day, if execution_pattern is REPEAT. Format should be HH:mm:ss. Defaults to None.

  • stop_time (str, optional) – The stop time of the execution day, if execution_pattern is REPEAT.Format should be HH:mm:ss. Defaults to None.

  • execution_repeat_interval (int, optional) – The repeat interval of minutes of the execution day, if execution_pattern is REPEAT. Defaults to None.

  • daily_pattern (ScheduleEnums.DailyPattern, optional) – The daily recurrence pattern of the schedule. Possible values are DAY, WEEKDAY. Defaults to None.

  • repeat_interval (int, optional) – The repeat interval of days of daily schedule, if daily_pattern is DAY. Defaults to None.

  • day (int, optional) – The day in month of monthly schedule, if monthly_pattern is DAY or, The day in month of yearly schedule, if yearly_pattern is DAY. Defaults to None.

  • month (int, optional) – The month in year of yearly schedule. Defaults to None.

  • week_offset (ScheduleEnums.WeekOffset, optional) – The week offset in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The week offset in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are FIRST, SECOND, THIRD, FOURTH, LAST. Defaults to None.

  • day_of_week (ScheduleEnums.DaysOfWeek, optional) – The days of week of weekly schedule or, The day of week in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The day of week in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. Defaults to None.

  • weekday_offset (ScheduleEnums.WeekdayOffset, optional) – The weekday offset in month of monthly schedule, if monthly_pattern is WEEKDAY. Defaults to None.

  • days_of_month (List[str], optional) – The days of month of monthly schedule, if monthly_pattern is DAYS_OF_MONTH. Must be provided as a list of one or more stringified digits (from ‘1’ to ‘31’). Defaults to None.

  • monthly_pattern (ScheduleEnums.MonthlyPattern, optional) – The monthly recurrence pattern of the schedule. Possible values are: DAY, DAY_OF_WEEK, WEEKDAY, LAST_DAY, DAYS_OF_MONTH. Defaults to None.

  • yearly_pattern (ScheduleEnums.YearlyPattern, optional) – The yearly recurrence pattern of the schedule. Possible values are DAY, DAY_OF_WEEK. Defaults to None.

Returns:

Schedule object with provided parameters.

delete() bool

Delete the schedule.

Returns:

True if deletion was successful else False.

Return type:

bool

disable(stop_date: Optional[Union[str, datetime]] = None) bool
Disable the schedule. Optional stop_date sets the date when

the schedule should be disabled.

Parameters:
  • stop_date – stop date provided either as a datetime or

  • format (as a string in yyyy-MM-dd) –

Returns:

Returns True if disabled properly. It does not mean that schedule is already expired, as it can take up to one day. If operation failed, return False.

enable(stop_date: str | datetime.datetime) bool

Enables schedule and sets stop date

Parameters:
  • stop_date – stop date provided either as a datetime or

  • format (as a string in yyyy-MM-dd) –

Returns:

Returns True if enabled properly, else False.

list_properties()

List all properties of the object.

mstrio.distribution_services.schedule.schedule.list_schedules(connection: Connection, to_dictionary: bool = False, limit: int = None, **filters) list[mstrio.distribution_services.schedule.schedule.Schedule] | list[dict]

List schedule objects or schedule dictionaries. Optionally filter list.

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

  • to_dictionary (bool, optional) – if True, return Schedules as list of dicts

  • limit (int, optional) – maximum number of schedules returned.

  • **filters – Available filter parameters:[‘name’:, ‘id’, ‘description’, ‘schedule_type’, ‘start_date’, ‘expired’]

Returns:

[description]

Return type:

list[“Schedule”] | list[dict]

mstrio.distribution_services.schedule.schedule_time module

class mstrio.distribution_services.schedule.schedule_time.ScheduleEnums

Bases: object

Object representations of recurrence information of a time-based schedule

class DailyPattern(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

DAY = 'day'
NONE = None
WEEKDAY = 'weekday'
class DaysOfWeek(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

FRIDAY = 'friday'
MONDAY = 'monday'
NONE = None
SATURDAY = 'saturday'
SUNDAY = 'sunday'
THURSDAY = 'thursday'
TUESDAY = 'tuesday'
WEDNESDAY = 'wednesday'
class ExecutionPattern(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

ONCE = 'once'
REPEAT = 'repeat'
class MonthlyPattern(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

DAY = 'day'
DAYS_OF_MONTH = 'days_of_month'
DAY_OF_WEEK = 'day_of_week'
LAST_DAY = 'last_day'
NONE = None
WEEKDAY = 'weekday'
class RecurrencePattern(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

DAILY = 'daily'
MONTHLY = 'monthly'
WEEKLY = 'weekly'
YEARLY = 'yearly'
class WeekOffset(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

FIRST = 'first'
FOURTH = 'fourth'
LAST = 'last'
NONE = None
SECOND = 'second'
THIRD = 'third'
class WeekdayOffset(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

FIRST = 'first'
LAST = 'last'
NONE = None
class YearlyPattern(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

DAY = 'day'
DAYOFWEEK = 'dayofweek'
NONE = None
class mstrio.distribution_services.schedule.schedule_time.ScheduleTime(recurrence_pattern: Optional[Union[RecurrencePattern, str]] = None, execution: Optional[Execution] = None, daily: Optional[Daily] = None, weekly: Optional[Weekly] = None, monthly: Optional[Monthly] = None, yearly: Optional[Yearly] = None)

Bases: Dictable

Object representation of details of time-based schedule

class Daily(daily_pattern: Union[DailyPattern, str] = DailyPattern.DAY, repeat_interval: int = 1)

Bases: Dictable

Object representation of daily recurrence information of the schedule

class Execution(execution_pattern: Union[ExecutionPattern, str] = ExecutionPattern.ONCE, execution_time: Optional[str] = None, start_time: Optional[str] = None, stop_time: Optional[str] = None, repeat_interval: Optional[int] = 1)

Bases: Dictable

Object representation of the execution information of the schedule

class Monthly(monthly_pattern: Union[MonthlyPattern, str], repeat_interval: int, day: Optional[int] = None, week_offset: Optional[Union[WeekOffset, str]] = None, day_of_week: Optional[Union[DaysOfWeek, str]] = None, weekday_offset: Optional[Union[WeekdayOffset, str]] = None, days_of_month: Optional[str] = None)

Bases: Dictable

Object representation of monthly recurrence information of the schedule

class Weekly(days_of_week: Optional[Union[List[DaysOfWeek], List[str]]] = None, repeat_interval: int = 1)

Bases: Dictable

Object representation of weekly recurrence information of the schedule

class Yearly(yearly_pattern: Union[YearlyPattern, str] = YearlyPattern.DAY, month: int = 1, day: int = 1, week_offset: Optional[Union[WeekOffset, str]] = None, day_of_week: Optional[Union[DaysOfWeek, str]] = None)

Bases: Dictable

Object representation of yearly recurrence information of the schedule

classmethod from_details(recurrence_pattern: Union[RecurrencePattern, str], execution_pattern: Union[ExecutionPattern, str], execution_time: Optional[str] = None, start_time: Optional[str] = None, stop_time: Optional[str] = None, execution_repeat_interval: Optional[int] = None, daily_pattern: Optional[Union[DailyPattern, str]] = DailyPattern.NONE, repeat_interval: Optional[int] = None, days_of_week: Optional[Union[List[DaysOfWeek], List[str]]] = None, day: Optional[int] = None, month: Optional[int] = None, week_offset: Optional[Union[WeekOffset, str]] = WeekOffset.NONE, day_of_week: Optional[Union[DaysOfWeek, str]] = DaysOfWeek.NONE, weekday_offset: Optional[str] = None, days_of_month: Optional[List[str]] = None, monthly_pattern: Optional[Union[MonthlyPattern, str]] = MonthlyPattern.NONE, yearly_pattern: Optional[Union[YearlyPattern, str]] = YearlyPattern.NONE)

Uses provided properties to create object representation of details of a time-based schedule.

This object is used as ‘time’ part of request body and is needed for creating and updating schedule.

Parameters:
  • recurrence_pattern (ScheduleEnums.RecurrencePattern, optional) – The recurrence pattern of the schedule. Possible values are DAILY, WEEKLY, MONTHLY, YEARLY Defaults to None.

  • execution_pattern (ScheduleEnums.ExecutionPattern, optional) – The execution pattern of the schedule. Possible values are ONCE, REPEAT. Defaults to None.

  • execution_time (str, optional) – The execution time of the execution day, if execution_pattern is ONCE. Format should be HH:mm:ss. Defaults to ‘’.

  • start_time (str, optional) – The start time of the execution day, if execution_pattern is REPEAT. Format should be HH:mm:ss. Defaults to ‘’.

  • stop_time (str, optional) – The stop time of the execution day, if execution_pattern is REPEAT. Format should be HH:mm:ss. Defaults to ‘’.

  • execution_repeat_interval (int, optional) – The repeat interval of minutes of the execution day, if execution_pattern is REPEAT. Defaults to None.

  • daily_pattern (ScheduleEnums.DailyPattern, optional) – The daily recurrence pattern of the schedule. Possible values are DAY, WEEKDAY. Defaults to None.

  • repeat_interval (int, optional) – The repeat interval of days of daily schedule, if daily_pattern is DAY or, The repeat interval of weeks of weekly schedule or, The repeat interval of months of monthly schedule. Defaults to None.

  • day (int, optional) – The day in month of monthly schedule, if monthly_pattern is DAY or, The day in month of yearly schedule, if yearly_pattern is DAY. Defaults to None.

  • month (int, optional) – The month in year of yearly schedule. Defaults to None.

  • week_offset (ScheduleEnums.WeekOffset, optional) – The week offset in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The week offset in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are FIRST, SECOND, THIRD, FOURTH, LAST. Defaults to None.

  • day_of_week (ScheduleEnums.DaysOfWeek, optional) – The days of week of weekly schedule or, The day of week in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The day of week in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. Defaults to None.

  • weekday_offset (ScheduleEnums.WeekdayOffset, optional) – The weekday offset in month of monthly schedule, if monthly_pattern is WEEKDAY. Possible values are: FIRST, LAST. Defaults to None.

  • days_of_month (List[str], optional) – The days of month of monthly schedule, if monthly_pattern is DAYS_OF_MONTH. Must be provided as a list of one or more stringified digits (from ‘1’ to ‘31’). Defaults to None.

  • monthly_pattern (ScheduleEnums.MonthlyPattern, optional) – The monthly recurrence pattern of the schedule. Possible values are: DAY, DAY_OF_WEEK, WEEKDAY, LAST_DAY, DAYS_OF_MONTH. Defaults to None.

  • yearly_pattern (ScheduleEnums.YearlyPattern, optional) – The yearly recurrence pattern of the schedule. Possible values are DAY, DAY_OF_WEEK. Defaults to None.

Returns:

Object representation of details of time-based schedule.

Return type:

ScheduleTime

update_properties(recurrence_pattern: Optional[Union[RecurrencePattern, str]] = None, execution_pattern: Optional[Union[ExecutionPattern, str]] = None, execution_time: Optional[str] = None, start_time: Optional[str] = None, stop_time: Optional[str] = None, execution_repeat_interval: Optional[int] = None, daily_pattern: Optional[Union[DailyPattern, str]] = None, repeat_interval: Optional[int] = None, days_of_week: Optional[Union[List[DaysOfWeek], List[str]]] = None, day: Optional[int] = None, month: Optional[int] = None, week_offset: Optional[Union[WeekOffset, str]] = None, day_of_week: Optional[Union[DaysOfWeek, str]] = None, weekday_offset: Optional[Union[WeekdayOffset, str]] = None, days_of_month: Optional[List[str]] = None, monthly_pattern: Optional[Union[MonthlyPattern, str]] = None, yearly_pattern: Optional[Union[YearlyPattern, str]] = None)

Updates ScheduleTime object according to provided parameters. If a provided parameter is not None then update it, else use its current value.

Parameters:
  • recurrence_pattern (ScheduleEnums.RecurrencePattern, optional) – The recurrence pattern of the schedule. Possible values are DAILY, WEEKLY, MONTHLY, YEARLY. Defaults to None.

  • execution_pattern (ScheduleEnums.ExecutionPattern, optional) – The execution pattern of the schedule. Possible values are ONCE, REPEAT. Defaults to None.

  • execution_time (str, optional) – The execution time of the execution day, if execution_pattern is ONCE. Format should be HH:mm:ss. Defaults to ‘’.

  • start_time (str, optional) – The start time of the execution day, if execution_pattern is REPEAT. Format should be HH:mm:ss. Defaults to ‘’.

  • stop_time (str, optional) – The stop time of the execution day, if execution_pattern is REPEAT. Format should be HH:mm:ss. Defaults to ‘’.

  • execution_repeat_interval (int, optional) – The repeat interval of minutes of the execution day, if execution_pattern is REPEAT. Defaults to None.

  • daily_pattern (ScheduleEnums.DailyPattern, optional) – The daily recurrence pattern of the schedule. Possible values are DAY, WEEKDAY. Defaults to None.

  • repeat_interval (int, optional) – The repeat interval of days of daily schedule, if daily_pattern is DAY. Defaults to None.

  • day (int, optional) – The day in month of monthly schedule, if monthly_pattern is DAY or The day in month of yearly schedule, if yearly_pattern is DAY. Defaults to None.

  • month (int, optional) – The month in year of yearly schedule. Defaults to None.

  • week_offset (ScheduleEnums.WeekOffset, optional) – The week offset in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The week offset in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are FIRST, SECOND, THIRD, FOURTH, LAST. Defaults to None.

  • day_of_week (ScheduleEnums.DaysOfWeek, optional) – The day of week in month of monthly schedule, if monthly_pattern is DAY_OF_WEEK or, The day of week in year of yearly schedule, if yearly_pattern is DAY_OF_WEEK. Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. Defaults to None.

  • days_of_week (List[ScheduleEnums.DaysOfWeek], optional) – The days of week of weekly schedule. Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. Defaults to None.

  • weekday_offset (ScheduleEnums.WeekdayOffset, optional) – The weekday offset in month of monthly schedule, if monthly_pattern is WEEKDAY. Defaults to None.

  • days_of_month (List[str], optional) – The days of month of monthly schedule, if monthly_pattern is DAYS_OF_MONTH. Must be provided as a list of one or more stringified digits (from ‘1’ to ‘31’). Defaults to None.

  • monthly_pattern (ScheduleEnums.MonthlyPattern, optional) – The monthly recurrence pattern of the schedule. Possible values are: DAY, DAY_OF_WEEK, WEEKDAY, LAST_DAY, DAYS_OF_MONTH. Defaults to None.

  • yearly_pattern (ScheduleEnums.YearlyPattern, optional) – The yearly recurrence pattern of the schedule. Possible values are DAY, DAY_OF_WEEK. Defaults to None.

Module contents