---
title: "Discussion on \"Tracking database changes in Flask Sqlalchemy for audit logs\" | Hashnode"
description: "Discussion on \"Tracking database changes in Flask Sqlalchemy for audit logs\". If you ever come across a situation where you need to track the changes in the database for auditing purposes or to make the history of all changes in the database. This kind of requirement often comes when we need to adhere to some kind of regulatio..."
url: "https://hashnode.com/posts/tracking-database-changes-in-flask-sqlalchemy-for-audit-logs/605ac9d378c4742436d4e7d5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Tracking database changes in Flask Sqlalchemy for audit logs](https://sagarkaurav.hashnode.dev/tracking-database-changes-in-flask-sqlalchemy-for-audit-logs?utm_source=hashnode&utm_medium=feed)

If you ever come across a situation where you need to track the changes in the database for auditing purposes or to make the history of all changes in the database. This kind of requirement often comes when we need to adhere to some kind of regulatio...

Mar 24, 2021 · 9 min read · sagarkaurav.hashnode.dev  
Read the article

-   [#databases](https://hashnode.com/tag/databases)
-   [#flask](https://hashnode.com/tag/flask)
-   [#sql](https://hashnode.com/tag/sql)
-   [#system-architecture](https://hashnode.com/tag/system-architecture)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)

## Written by

[Sagar Kaurav](https://hashnode.com/@sagarkaurav)

@sagarkaurav · India

  
[View profile](https://hashnode.com/@sagarkaurav)

Software engineer

I am a software engineer with 3 years of experience working for startups

## Responses 1

Markdown supported · ⌘↵ to post

[Bijay Shrestha](https://hashnode.com/@rukin)

[Mar 3, 2022](https://hashnode.com/posts/tracking-database-changes-in-flask-sqlalchemy-for-audit-logs/605ac9d378c4742436d4e7d5/comment/6220bfa03e59313a81db3017)

Great work. I got stock in one thing. How can I make model\_name name dynamic so that this function is useable for other model also. Thank for your work.

[Sagar Kaurav](https://hashnode.com/@sagarkaurav)

[Mar 4, 2022](https://hashnode.com/posts/tracking-database-changes-in-flask-sqlalchemy-for-audit-logs/605ac9d378c4742436d4e7d5/comment/6220bfa03e59313a81db3017#reply-6222228c5998063ea60d8448)

you can you `instance.__class__.__name__` or you can use `User.__name__`

[Bijay Shrestha](https://hashnode.com/@rukin)

[Mar 9, 2022](https://hashnode.com/posts/tracking-database-changes-in-flask-sqlalchemy-for-audit-logs/605ac9d378c4742436d4e7d5/comment/6220bfa03e59313a81db3017#reply-6228311b33120280724e84c4)

Thank you [Sagar Kaurav](https://hashnode.com/@sagarkaurav). It was very helpful.
