Using database triggers to reliably track model history with Wes Kendall

Tracking model history is an essential aspect of many problems encountered in web applications, from simple audit trails to preserving values of fields during state transitions. There are a wide array of approaches to do this with Django apps, almost all of which are subject to performance penalties, require unstructured JSON fields to track history, or can easily be bypassed accidentally in application code.

In this talk, we show a new way to to track history in Django with database triggers. We specifically focus on Postgres databases using the https://github.com/opus10/django-pghistory">django-pghistory app. We discuss the benefits of using database triggers for history in the context of simplicity, performance, and reliability. We also discuss the benefits of using structured history tables and how this can allow engineers to solve complex history-related modeling problems.

Attendees of this talk will be exposed to a totally new way to think about history tracking in their application, along with an understanding of the pros and cons of using database triggers to track history in practice.

This talk was presented at: https://2023.djangocon.us/talks/using-database-triggers-to-reliably-track-model-history/

LINKS: Follow Wes Kendall 👇

Follow Maxwell Muoto 👇 On Twitter: https://twitter.com/maxmuoto

Follow DjangCon US 👇 https://fosstodon.org/@djangocon https://twitter.com/djangocon

Follow DEFNA 👇 https://www.defna.org/

Video production by the presenter and DjangoCon US 2023 volunteers.

Date Added: September 19, 2024

Watch Video