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.1

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.1
File Size Uploaded
fastpluggy_db_purge-1.0.1.tar.gz 32.4 kB Details

Built distribution (wheel)

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

Total release size: 58.3 kB

Release files / fastpluggy_db_purge-1.0.1.tar.gz

Download URL fastpluggy_db_purge-1.0.1.tar.gz
Size 32.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d9f1b66d1c5996b68cedec2dff8534f7c7f857dbeb995ff11fed6b9a527e0b9a
BLAKE2b-256 checksum
How to use checksums
79100bf97abf3c569337ebf383dcedbc3bc2d8865598c9fb4af56b3d2d1fbceb
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.1-py3-none-any.whl

Download URL fastpluggy_db_purge-1.0.1-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
431883da9d01098126c664a74e094e1506b52ce8054e14394ab06734adab414d
BLAKE2b-256 checksum
How to use checksums
be4d7be52df731b65c85149063b32b7ead5ec7cc7e4ce76661a79015ba816825
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

This release

1.0.1 This release

2 release files

1.0.0

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