'Lower boilerplate way of creating a TABLE, VIEW and TRIGGER all at once for storing repetitive values

In Sqlite column with repetitive values there is a solution for dealing with columns that have repetitive values by defining a VIEW and a TRIGGER on the tables. The view/trigger solution is nice and performant but I have to write a lot of boilerplate to set this all up (especially if a lot of columns are duplicate in this way). Is there a lightweight way to skip this boilerplate? I'm working in Python so a SQL library in Python would also be acceptable (though I'm not really interested in using a full on ORM).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source