Datenbanken und Datendateien
DBReduce
Vom Dump in Produktionsgröße zum Fehlerbericht zum Anhängen. Eine PostgreSQL-Datenbank auf die wenigen Zeilen und Tabellen verkleinern, mit denen ein Test weiterhin fehlschlägt.
- Version
- v0.5.1, 31. Okt. 2026
- Läuft auf
- Python 3.10–3.15; PostgreSQL 13–18 mit passenden pg_dump, pg_restore und psql
- Lizenz
- Apache-2.0
Die folgende Projektbeschreibung ist auf Englisch.
So sieht es aus
dbreduce reduce \
--database postgresql://localhost/app_bug \
--oracle 'uv run pytest tests/test_checkout.py::test_negative_total' \
--match-stdout 'AssertionError: negative total' \
--confirm 3Wagtail #9208
Rows: 150,706 -> 3
Tables: 48 -> 1
Failure identity: preserved
Fresh SQL restore: PASSWas es tut
Give DBReduce a PostgreSQL database and a command that fails because of a bug. It removes rows, following foreign keys and the relationships you declare, and keeps only candidates where the same failure still happens. Optionally it also removes whole tables. The result is a small SQL file that reproduces the bug.
Für wen
- Developers who need a minimal reproducer for a data-dependent bug.
- Maintainers who receive bug reports that only fail on someone’s database.
Einschränkungen
- The oracle runs against a disposable copy, but SQL functions, triggers and external services can still have side effects. Use trusted commands and dumps.
- Needs a database role with CREATEDB.
- DBReduce does not promise a global minimum; reports state when local irreducibility cannot be claimed.
Typische Einsätze
Reduce a failing test case
Point DBReduce at a copy of the database and your test command, and match the failure by its output or a JSON verdict so an unrelated error does not count.
Share a safe reproducer
The output is dbreduce.min.sql plus a report with row counts and timings, without raw test output.
Installieren
Neueste stabile Version v0.5.1, veröffentlicht am 31. Okt. 2026. Versionshinweise zu v0.5.1. Versionsdaten am 31. Okt. 2026 aus GitHub Releases abgerufen.
Erster Start
Install the CLI as a standalone tool:
uv tool install dbreduce dbreduce --helpMake sure your test reads the database URL from DATABASE_URL or DBREDUCE_DATABASE_URL.
Run dbreduce reduce with a matcher that identifies the bug, then attach dbreduce.min.sql to the bug report.
Plattformen und wie sie geprüft wurden
- PostgreSQL 13–18Wird in der CI gebaut und automatisch geprüft
Snapshot isolation by default; the clone backend is experimental and needs PostgreSQL 15+.
- Python 3.10–3.15Wird in der CI gebaut und automatisch geprüft
Installed as a standalone tool; your application can be in any language.
Dokumentation und Support
Fragen und Fehlerberichte gehören in den Issue-Tracker des Projekts. Sicherheitsprobleme melden Sie wie in seiner Sicherheitsrichtlinie beschrieben.