r/FastAPI • • May 16 '25

Question compare/create snapshots

Hi,

I'm sorry if anyone made this question before but I cannot find a good answer and Chatgpt changes his mind every time I ask.

I have a Postgress database and use Fastapi with SQLAlchemy.
For the future, I need the differences between specific Columns to an older point in time. So I have to compare them to an older point/snapshot or between snapshots.

What is the best option for implementing this?

The users can only interact with the database through Fastapi endpoints.
I have read about Middleware, but before doing that manually I want to ask if there is maybe a better way.

Thanks in advance!

6 Upvotes

16 comments sorted by

View all comments

Show parent comment

2

u/BluesFiend May 16 '25

yeah sounds like an audit log type table is needed to track changes, the real question is what actual problem is trying to be solved. comparing past values might be the wrong solution to the actual problem that could be solved with an ootb solution