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.0.tar.gz (28.6 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.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_sqlitetrigger-0.1.0.tar.gz
  • Upload date:
  • Size: 28.6 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.0.tar.gz
Algorithm Hash digest
SHA256 638799001c877610fc776d7d6ae579a12a5bcff732d75bfda884c28e56570efa
MD5 94d2aac087011fbc0eb53e2b5af61075
BLAKE2b-256 32a52004d52c8ae54d542d11bf02a66a547c856f6c9557c179b5c1eb0a58278d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_sqlitetrigger-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 896f5bc1385389b0fc6d359ca8c21f47860fd216789b6525f19d12f718447a35
MD5 f2d9dac5d67689b04ac339927424d56c
BLAKE2b-256 3a1f289028ea5a33f2ecf8477c2c8c52b1a236bf99cca12200929ba16769827e

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