Can I add a custom column to the 'transaction' table automatically generated by SQLAlchemy-Continuum for audit trail?

67 views Asked by At

I've successfully performed a log of an UPDATE action of a PostgreSQL database using SQLAlchemy ORM. Firstly, using Alembic, I've migrated the automatically generated 'XXX_version' (where XXX is the name of the original table) and 'transaction' tables. The 'XXX_version' holds the newly updated row in the respective table, while the 'transaction' table holds the time stamp of the change. Now I want to add another column to the 'transaction' table that holds the user ID that performed the change. The user ID comes from my Django app (from where the users are performing the change, in a UI). I'm currently using SQLAlchemy 2.0.18 but I'm willing to downgrade to 1.4.x if necessary.

In general terms, is it possible to add a custom column to the 'transaction' table (and populate it when committing a new change)? More specifically, does anyone know how to save the user ID from Django on this table?

0

There are 0 answers