Skip to main content

fastpluggy-db-purge

DB Purge Release Pipeline Status Coverage

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_targets hook — 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:

  1. Registers the table + declared defaults in the in-memory registry, so it shows on the DB Purge dashboard (marked declared by plugin).
  2. 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_rules gained a declared_hash column. Existing installs are migrated automatically on load via a guarded ALTER TABLE ... ADD COLUMN (idempotent; SQLite + PostgreSQL).

Metadata

Release files for fastpluggy-db-purge 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastpluggy-db-purge 1.0.0
File Size Uploaded
fastpluggy_db_purge-1.0.0.tar.gz 31.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastpluggy-db-purge 1.0.0
File Interpreter ABI Platform
fastpluggy_db_purge-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 57.0 kB

Release files / fastpluggy_db_purge-1.0.0.tar.gz

Download URL fastpluggy_db_purge-1.0.0.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4869dd20536fbf19f2c56b68fd6ac08b662d0b2e7381782305b30f714644563e
BLAKE2b-256 checksum
How to use checksums
27a9fb14472325c5559e1b1dc42e6694576918fe3ac23fb4da202ed50376dcef
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.0-py3-none-any.whl

Download URL fastpluggy_db_purge-1.0.0-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41e2e4a57797aeebe076bd9abbdbda2fa5dbf25b87bf28a53c2ebfdaa10b0195
BLAKE2b-256 checksum
How to use checksums
64e0b83b333579091b0c0dfcd19403f39c77232fb933a09b1001e0ba285cd621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page