Triggers¶
The trigger
module defines two classes, Trigger
and
TriggerDict
, derived from DbSchemaObject
and
DbObjectDict
, respectively.
Trigger¶
Trigger
is derived from
DbSchemaObject
and represents a Postgres
regular or constraint trigger.
-
class
pyrseas.dbobject.trigger.
Trigger
(name, schema, table, description, procedure, timing, level, events, constraint=False, deferrable=False, initially_deferred=False, referencing_new=None, referencing_old=None, columns=[], condition=None, arguments='', oid=None)¶ A procedural language trigger
-
Trigger.
identifier
()¶ Returns a full identifier for the trigger
Returns: string
-
Trigger.
to_map
(db)¶ Convert a trigger to a YAML-suitable format
Returns: dictionary
-
Trigger.
create
(dbversion=None)¶ Return SQL statements to CREATE the trigger
Returns: SQL statements
Trigger Dictionary¶
TriggerDict
is derived from
DbObjectDict
. It is a dictionary that
represents the collection of triggers in a database.
-
class
pyrseas.dbobject.trigger.
TriggerDict
(dbconn=None)¶ The collection of triggers in a database
-
TriggerDict.
from_map
(table, intriggers)¶ Initialize the dictionary of triggers by converting the input map
Parameters: - table – table owning the triggers
- intriggers – YAML map defining the triggers