Event Triggers

The eventtrig module defines two classes, EventTrigger and EventTriggerDict, derived from DbObject and DbObjectDict, respectively.

Event Trigger

EventTrigger is derived from DbObject and represents an event trigger available from PostgreSQL 9.3 onwards.

class pyrseas.dbobject.eventtrig.EventTrigger(name=None, description=None, owner=None, privileges=None, **attrs)

An event trigger

EventTrigger.create(obj, *args, **kwargs)

Return SQL statements to CREATE the event trigger

Returns:SQL statements

Event Trigger Dictionary

EventTriggerDict is derived from DbObjectDict. It is a dictionary that represents the collection of event triggers in a database.

class pyrseas.dbobject.eventtrig.EventTriggerDict(dbconn=None)

The collection of event triggers in a database

EventTriggerDict.from_map(intriggers, newdb)

Initalize the dictionary of triggers by converting the input map

Parameters:
  • intriggers – YAML map defining the event triggers
  • newdb – dictionary of input database
EventTriggerDict.diff_map(intriggers)

Generate SQL to transform existing event triggers

Parameters:intriggers – a YAML map defining the new event triggers
Returns:list of SQL statements

Compares the existing event trigger definitions, as fetched from the catalogs, to the input map and generates SQL statements to transform the event triggers accordingly.