fastpluggy-db-purge
Centralized database retention management and purge plugin for FastPluggy.
Features
- Auto-discover all database tables with row counts and sizes
- Per-table retention policies via admin UI
- Plugin-declared purge targets via
fp_purge_targetshook — declaring a table upserts a disabled rule an admin enables to validate (see below) - Manual and scheduled purge with batched deletes
- Full audit trail of purge operations
Installation
pip install fastpluggy-db-purge
Configuration
| Setting | Default | Description |
|---|---|---|
default_retention_days |
30 | Global fallback retention |
batch_size |
5000 | Rows per DELETE batch |
dry_run_by_default |
True | Safety default for manual purges |
auto_purge_enabled |
False | Enable scheduled purge |
auto_purge_cron |
0 4 * * * |
Cron schedule (daily 4am UTC) |
Declaring purge targets from another plugin
A plugin can declare its own tables as purgeable from its on_load_complete():
from fastpluggy_plugin.db_purge.hooks import register_purge_target
register_purge_target("task_reports", "end_time", default_retention_days=30)
This does two things:
- Registers the table + declared defaults in the in-memory registry, so it shows on the DB Purge dashboard (marked declared by plugin).
- Upserts a persistent rule in
fp_purge_rules, created disabled. An admin must enable it in the web UI before anything is deleted — a validation gate, so declaring a table can never silently purge its data.
If the plugin later changes what it declares (timestamp column or retention),
the rule is refreshed and re-disabled for the admin to re-validate.
Provenance is tracked by a declared_hash column: plugin-managed rows carry the
hash; admin-created rows have declared_hash = NULL and are never touched by the
hook.
To exclude a config/system table from purge entirely:
from fastpluggy_plugin.db_purge.hooks import register_purge_excluded
register_purge_excluded("my_plugin_config")
Schema note (v1.0.0):
fp_purge_rulesgained adeclared_hashcolumn. Existing installs are migrated automatically on load via a guardedALTER TABLE ... ADD COLUMN(idempotent; SQLite + PostgreSQL).
Metadata
Release files for fastpluggy-db-purge 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastpluggy_db_purge-1.0.2.tar.gz | 34.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastpluggy_db_purge-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.5 kB
Release files / fastpluggy_db_purge-1.0.2.tar.gz
| Download URL | fastpluggy_db_purge-1.0.2.tar.gz |
|---|---|
| Size | 34.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19da7fd96d3d13239f4a5fcb8e36e7fb1d94e01416914d59bd355b9b88bd6132
|
|
BLAKE2b-256 checksum How to use checksums |
bb2485f99f3932b26f103c93b4eaa34ffe8a61c0c5c314d8d83e63197debc8da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / fastpluggy_db_purge-1.0.2-py3-none-any.whl
| Download URL | fastpluggy_db_purge-1.0.2-py3-none-any.whl |
|---|---|
| Size | 26.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96487f1b163c3331091f7bccd17d18ac6da554670178a69b1b6e9e4ddc895ad1
|
|
BLAKE2b-256 checksum How to use checksums |
c70307fd96ae69fffd490dc784afbf6d769c9c57b9ba1d89f8d21d58b762db26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|