Bancos e arquivos de dados
DBReduce
De um dump do tamanho da produção a um relato de bug que dá para anexar. Reduza um banco PostgreSQL às poucas linhas e tabelas que ainda reproduzem um teste com falha.
- Versão
- v0.5.1, 31 de out. de 2026
- Funciona em
- Python 3.10–3.15; PostgreSQL 13–18 com pg_dump, pg_restore e psql da mesma versão
- Licença
- Apache-2.0
A descrição do projeto abaixo está em inglês.
Como é
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: PASSO que faz
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.
Para quem é
- Developers who need a minimal reproducer for a data-dependent bug.
- Maintainers who receive bug reports that only fail on someone’s database.
Limitações
- 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.
Usos comuns
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.
Instalar
Última versão estável v0.5.1, publicada em 31 de out. de 2026. Notas da versão de v0.5.1. Dados de versões consultados em 31 de out. de 2026 no GitHub Releases.
Primeiro uso
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.
Plataformas e como foram verificadas
- PostgreSQL 13–18Compila e passa nas verificações automáticas da CI
Snapshot isolation by default; the clone backend is experimental and needs PostgreSQL 15+.
- Python 3.10–3.15Compila e passa nas verificações automáticas da CI
Installed as a standalone tool; your application can be in any language.
Documentação e suporte
Perguntas e relatos de bugs vão para o rastreador de issues do projeto. Relate problemas de segurança como descrito na política de segurança.