Skip to content

Trigger

Bases: Component

Syntax of Triggers in Class Definitions

Trigger Name [ Keywords ]  
{ 
    Implementation
}

impl = field(default_factory=list)

Trigger implementation

Can be a simple string for already indented and newline delimited code, or for use with CodeMode = expression or a list of strings for multiline code, in which case will be indented automatically by the generator.

Objectscript routine code generation and syntax validation is not supported by this library.

keywords = field(default_factory=dict, kw_only=True)

Trigger Syntax and Keywords

Optional dict used to specify keywords for this component.

Use {"Keyword": None} for keywords that do not have a value.

Valid Trigger keywords
  • CodeMode – Specifies how this trigger is implemented.
  • Event – Specifies the SQL events that will fire this trigger. Required (no default).
  • Final – Specifies whether this trigger is final (cannot be overridden in subclasses).
  • Foreach – Controls when the trigger is fired.
  • Internal – Specifies whether this trigger definition is internal (not displayed in the class documentation).
  • Language – Specifies the language in which the trigger is written.
  • NewTable – Specifies the name of the transition table that stores the new values of the row or statement affected by the event for this trigger.
  • OldTable – Specifies the name of the transition table that stores the old values of the row or statement affected by the event for this trigger.
  • Order – In the case of multiple triggers for the same EVENT and TIME, specifies the order in which the triggers should be fired.
  • SqlName – Specifies the SQL name to use for this trigger.
  • Time – Specifies whether the trigger is fired before or after the event.
  • UpdateColumnList – Specifies one or more columns whose modification causes the trigger to be fired by SQL. Available only for TSQL.