You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, required session fields (session_id, session_date, potentially user_id, etc.) need to be provided when starting a history session, otherwise the triggers will fail. This was by design, so triggers fail loudly without context. However, there are applications with substantial "external" database operations (Django management commands, custom SQL, etc.) that are difficult or impossible to wrap in a history session. For instance, running custom SQL on an SQLite database (where you can't create the necessary user-defined functions in SQL yourself), or using a management command from a third-party Django package.
It would be nice to have a way to specify trigger-level default values for fields. It should be off by default, and the pitfalls of silently recording these defaults should be documented, but it should at least be possible.
It would also be nice to have a way to hook into all manage.py commands, but this will be a separate issue as it will require a PR to Django itself.
The text was updated successfully, but these errors were encountered:
Shortly after opening this, I remembered that https://docs.djangoproject.com/en/4.1/ref/signals/#connection-created exists and could be used to create a default session per Django connection. That has the benefit of allowing applications to be very explicit about how the default values should work, but doesn't address being able to run raw SQL on SQLite. So I'll leave this open to think about some more.
Right now, required session fields (
session_id
,session_date
, potentiallyuser_id
, etc.) need to be provided when starting a history session, otherwise the triggers will fail. This was by design, so triggers fail loudly without context. However, there are applications with substantial "external" database operations (Django management commands, custom SQL, etc.) that are difficult or impossible to wrap in a history session. For instance, running custom SQL on an SQLite database (where you can't create the necessary user-defined functions in SQL yourself), or using a management command from a third-party Django package.It would be nice to have a way to specify trigger-level default values for fields. It should be off by default, and the pitfalls of silently recording these defaults should be documented, but it should at least be possible.
It would also be nice to have a way to hook into all manage.py commands, but this will be a separate issue as it will require a PR to Django itself.
The text was updated successfully, but these errors were encountered: