pythonmysqlormpeeweehistorical-db

How to do the versioning with a history table in Peewee?


I have one ETL tool to read data from various files and stores it in MySQL using Peewee ORM. Now I want to keep store all the fields that will update in a different table. Do we have any plug & play type solution in Peewee? Please help me out.


Solution

  • This may help get you started: https://github.com/coleifer/peewee/blob/master/playhouse/sqlite_changelog.py

    The idea is to use triggers and json functions to populate a changelog table. You could modify it to work with postgres or mysql.