Package¶
Level clause¶
-
pgtrigger.
Row
= <pgtrigger.core._Level object>¶
-
pgtrigger.
Statement
= <pgtrigger.core._Level object>¶
When clause¶
-
pgtrigger.
After
= <pgtrigger.core._When object>¶
-
pgtrigger.
Before
= <pgtrigger.core._When object>¶
-
pgtrigger.
InsteadOf
= <pgtrigger.core._When object>¶
Operation clause¶
-
pgtrigger.
Truncate
= <pgtrigger.core._Operation object>¶
-
pgtrigger.
Delete
= <pgtrigger.core._Operation object>¶
-
pgtrigger.
Insert
= <pgtrigger.core._Operation object>¶
-
pgtrigger.
Update
¶
Referencing clause¶
Conditions¶
-
class
pgtrigger.
Condition
(sql=None)[source]¶ For specifying free-form SQL in the “condition” clause of a trigger
-
class
pgtrigger.
Q
(*args, _connector=None, _negated=False, **kwargs)[source]¶ Similar to Django’s Q object, allows referencing the old and new rows in a trigger condition.
-
class
pgtrigger.
F
(*args, **kwargs)[source]¶ Similar to Django’s F object, allows referencing the old and new rows in a trigger condition.
Triggers¶
-
class
pgtrigger.
Trigger
(*, name=None, level=None, when=None, operation=None, condition=None, referencing=None, func=None)[source]¶ For specifying a free-form PL/pgSQL trigger function or for creating derived trigger classes.
Management¶
-
pgtrigger.
get
(*uris)[source]¶ Get triggers matching URIs or all triggers registered to models
A URI is in the format of “app_label.model_name:trigger_name”
-
pgtrigger.
install
(*uris)[source]¶ Install registered triggers matching URIs or all triggers if URIs aren’t provided. If URIs aren’t provided, prune any orphaned triggers from the database
-
pgtrigger.
uninstall
(*uris)[source]¶ Uninstalls registered triggers matching URIs or all triggers if no URIs are provided.
Running migrations will re-install any existing triggers. This behavior is overridable with
settings.PGTRIGGER_INSTALL_ON_MIGRATE
Note: This will not uninstall triggers when deleting a model. This operation is performed by the “prune” command.
-
pgtrigger.
enable
(*uris)[source]¶ Enables registered triggers matching URIs or all triggers if no URIs are provided
-
pgtrigger.
disable
(*uris)[source]¶ Disables registered triggers matching URIs or all triggers if no URIs are provided