sqlmeta.objects.event

MySQL Event SQL Model.

Classes

Event(name[, schema, definition, schedule, ...])

Represents a MySQL scheduled event.

class sqlmeta.objects.event.Event(name: str, schema: str | None = None, definition: str | None = None, schedule: str | None = None, enabled: bool = True, comment: str | None = None, definer: str | None = None, event_type: str = 'ONE TIME', dialect: str | None = 'mysql')[source]

Represents a MySQL scheduled event.

__init__(name: str, schema: str | None = None, definition: str | None = None, schedule: str | None = None, enabled: bool = True, comment: str | None = None, definer: str | None = None, event_type: str = 'ONE TIME', dialect: str | None = 'mysql')[source]

Initialize a MySQL event.

Parameters:
  • name – Event name

  • schema – Schema/database name (optional)

  • definition – Event body (DO clause)

  • schedule – Schedule expression (AT or EVERY clause)

  • enabled – Whether the event is enabled

  • comment – Event comment/description

  • definer – User who defined the event

  • event_type – Event type (ONE TIME or RECURRING)

  • dialect – SQL dialect (defaults to mysql)

property create_statement: str

Generate CREATE EVENT statement.

Returns:

CREATE EVENT statement

__str__() str[source]

Return string representation of the event.

__eq__(other: Any) bool[source]

Check if two events are equal.

classmethod from_dict(data: Dict[str, Any]) Event[source]

Create event from dictionary representation.

Parameters:

data – Dictionary with event attributes

Returns:

Event object

to_dict() Dict[str, Any][source]

Convert event to dictionary representation.

Returns:

Dictionary with event attributes