paradox-db-py
Modernising a 1990s system means reading its data without losing a single record, and handing tables back so the old and new systems can coexist for months.
- 104tests, including round-trip properties (Hypothesis)
- 0runtime dependencies
- 1.3 sto open and decode 50,000 records
- 3explicit cell states: OK, NULL, INVALID
- 3.0-7Paradox versions supported
- MITlicence · PyPI 0.1.0
Try it: the real package, in your browser
A synthetic Paradox table built to show what matters: two records the header does not declare, an unreadable BCD amount, null values, memos stored in the .MB file and text in the CP437 code page.
Downloads Pyodide (Python compiled to WebAssembly, about 10 MB, from the jsDelivr CDN) and installs the paradoxdb 0.1.0 wheel published on PyPI, served from this page. Everything runs in your browser.
The Python code that just ran
Open your own table
Choose a .DB file and, if it has memos, its .MB. The files are read in your browser and never leave your computer.
The problem
A fixed-asset management system written in Delphi on the Borland Database Engine kept decades of history in Paradox tables. Modernising it required two things at once: extracting every record without loss, including those the old engine left in the blocks without counting them in the header and BCD amounts that no longer decoded; and handing tables back to the old application during a long transition.
What the Python ecosystem offered was a binding over a GPL C library: read-only in practice, with a global text encoding, skipping undeclared records and corrupting its memory after a few dozen writes. For a product installed on the client’s own servers, none of that would do.
How I solved it
- Pure Python and MIT licence, with no runtime dependencies.
- No silent conversions: every cell comes back as
OK,NULLorINVALID, with its raw bytes and the reason. The previous version turned unreadable amounts and sentinel dates into blanks: invisible data loss at scale. - Every record in every block, including those the header does not declare, with the mismatch reported.
- Code page per table, read from the header: real datasets mix CP437 and CP1252.
Decimalfor amounts and BCD of up to 32 digits; neverfloat.- Writing over a template header: the new file keeps version, descriptors, key and code page, the primary
.PXindex is rebuilt and a verifier checks it is consistent. Always new files, never in-place edits. - A CLI to profile a directory of tables with SHA-256, export to CSV or JSON with each cell’s state, and verify indexes.
How it was validated
The test suite covers every case in the specification using synthetic data generated by the repository itself. In the original project the same design was checked against about 120 real tables (around 225,000 rows) with zero byte or value differences from the C library. Those tables cannot be published; the figure is given for context.
A clean-room case study
The patterns come from my work at Intervalor Data and are published with the company’s permission. The repository was implemented in a separate session from a written specification and public documentation only, and an independent review compared it with the original before publishing: zero identical fragments. An anti-leak test and gitleaks run in CI.
Technologies
- Python 3.11+
- pytest
- Hypothesis
- ruff
- GitHub Actions
- gitleaks
- hatchling