Skip to main content

DBReduce

Give DBReduce a PostgreSQL database and a failing test. It finds a smaller relational dataset that still reproduces the same bug.

PyPI Python License Tests

DBReduce reduces PostgreSQL data while checking that each candidate preserves the original failure identity. It supports output matchers and structured JSON verdicts, keeps oracle writes out of accepted data, and follows both PostgreSQL foreign keys and explicitly configured application relationships.

Quick start

DBReduce requires Python 3.13 or newer, PostgreSQL, and client tools (pg_dump and pg_restore) compatible with your server. Install it with:

python -m pip install dbreduce

Then reduce a database with a test that identifies the bug:

dbreduce reduce \
  --database postgresql://localhost/app_bug \
  --oracle 'uv run pytest tests/test_checkout.py::test_negative_total' \
  --match-stdout 'AssertionError: negative total' \
  --confirm 3

The oracle must connect through DATABASE_URL or DBREDUCE_DATABASE_URL. DBReduce sets both variables to its disposable workspace for every run. Use a database role with CREATEDB permission. The source database is read only; reductions and oracle executions run against a generated copy. Use trusted commands and dumps: SQL functions, triggers, and external services can have effects outside that copy.

For an oracle that can report a stable signature directly, use --oracle-json and have it write {"reproduced": true, "signature": "checkout-negative-total"} to stdout. See the guide for the verdict protocol and safety details.

What it does

  • Checks failure identity so an unrelated error does not count as reproducing the bug.
  • Isolates each oracle run so its database writes do not affect later candidates.
  • Reduces through real foreign keys and declared single or composite relationships.
  • Reports the final identity, candidate outcomes, timings, and row counts without saving raw oracle output.

Without an identity matcher, legacy mode accepts any nonzero application exit status and prints a warning. The result is locally irreducible under attempted relationship-closed transformations; DBReduce does not promise a global minimum. By default, DBReduce writes dbreduce.min.sql and dbreduce-report.json and never overwrites existing files.

Documentation

Licensed under Apache-2.0.

Metadata

Release files for dbreduce 0.2.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 dbreduce 0.2.0
File Size Uploaded
dbreduce-0.2.0.tar.gz 65.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbreduce 0.2.0
File Interpreter ABI Platform
dbreduce-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.2 kB

Release files / dbreduce-0.2.0.tar.gz

Download URL dbreduce-0.2.0.tar.gz
Size 65.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7a85f22b18f3eeb3b1468dee28eabd9103a36b2fab65f30c4ce34f2e4a47e8ef
BLAKE2b-256 checksum
How to use checksums
0cf38fa26ebe275b6437476af0e53e444117198eb26489a6215fc3a769ba29a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / dbreduce-0.2.0-py3-none-any.whl

Download URL dbreduce-0.2.0-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
381bc1a0c7b8cd2af07f39ae0ae88cb16e95eab01b3ae09885cdfe956bbac933
BLAKE2b-256 checksum
How to use checksums
6f43d44e12f49b7a7fe314551c53c0d434a6e9a1f54c4c2af161c8319ebd617c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.2

2 release files

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