Skip to main content

SQLite trigger support integrated with Django models.

Project description

django-sqlitetrigger

SQLite trigger support integrated with Django models.

Inspired by django-pgtrigger, this package provides declarative trigger support for SQLite-backed Django projects. I'm very grateful for the existence of django-pgtrigger, without which I don't think this package could exist.

AI disclosure

To be super clear: this project was built by prompting GitHub Copilot to modify django-pgtrigger for use with SQLite. I was in the process of doing something very similar manually, when it dawned on me that this is the ideal use for today's agentic AI coding systems.

The resulting package is usable by me for my purposes. As the license notes, it comes with no warranty or expectation that it'll solve your problems.

Quick start

Install and add sqlitetrigger to INSTALLED_APPS:

INSTALLED_APPS = [
    "sqlitetrigger",
    # ...
]

Add triggers to your models:

import sqlitetrigger

class ProtectedModel(models.Model):
    """This model cannot be deleted!"""

    class Meta:
        triggers = [
            sqlitetrigger.Protect(name="protect_deletes", operation=sqlitetrigger.Delete)
        ]

Install triggers:

python manage.py sqlitetrigger install

Built-in triggers

  • Protect — prevent insert, update, or delete operations
  • ReadOnly — prevent changes to specific fields
  • SoftDelete — intercept deletes and set a field instead
  • FSM — enforce valid field state transitions

Running tests

uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_sqlitetrigger-0.1.1.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_sqlitetrigger-0.1.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file django_sqlitetrigger-0.1.1.tar.gz.

File metadata

  • Download URL: django_sqlitetrigger-0.1.1.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.1 {"installer":{"name":"uv","version":"0.10.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_sqlitetrigger-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7904355ec8c49d271ae1e70d31f189ca48793125dd4124905129db5a84d8c174
MD5 301bb4f87d0b37ad0bbb928ec4cc8e0a
BLAKE2b-256 83bee1312587077210db17223b5563767322bc9e096625e68c2c5085be84ce45

See more details on using hashes here.

File details

Details for the file django_sqlitetrigger-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: django_sqlitetrigger-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.1 {"installer":{"name":"uv","version":"0.10.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_sqlitetrigger-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61e389464b92e9d9ded0a7470f91a2fc761494240035509c5e35770ae7890d00
MD5 e4daef1301ec846fa9bade0b918b06cc
BLAKE2b-256 fae7d69283045a794ab345f915f9267c8f9cf663a90f43a095a128010a49f172

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page