table.triggers_dict property, closes #211

This commit is contained in:
Simon Willison 2021-01-01 18:10:04 -08:00
commit b067f1ff57
3 changed files with 22 additions and 1 deletions

View file

@ -1458,6 +1458,15 @@ The ``.triggers`` property lists database triggers. It can be used on both datab
>>> db.triggers
... similar output to db["authors"].triggers
The ``table.triggers_dict`` property returns the triggers for that table as a dictionary mapping their names to their SQL definitions.
::
>>> db["authors"].triggers_dict
{'authors_ai': 'CREATE TRIGGER [authors_ai] AFTER INSERT...',
'authors_ad': 'CREATE TRIGGER [authors_ad] AFTER DELETE...',
'authors_au': 'CREATE TRIGGER [authors_au] AFTER UPDATE'}
The ``detect_fts()`` method returns the associated SQLite FTS table name, if one exists for this table. If the table has not been configured for full-text search it returns ``None``.
::