r/pythontips • u/Roenbaeck • 11h ago
Module Positorium, a database for facts that disagree
Most databases are designed to answer: "What is the value now?"
They can model a more awkward question too, but usually require additional machinery:
Who claimed what, when was it considered true, how certain were they, and what did we believe before it was corrected?
I built Positorium as an experimental embedded evidence database for that second kind of question. Rather than overwriting one claim with another, it preserves contradictory claims together with their sources, certainty, effective time, assertion time, corrections, and retractions.
It is not intended to replace PostgreSQL or another operational database. The idea is to use it as a focused evidence layer for things like compliance, investigations, conflicting master data, or any process where retaining the history of disagreement matters.
The new Python package embeds the Rust engine directly in the Python process, so there is no separate server. It supports both ephemeral in-memory databases and append-only persistent stores.
Install the beta with:
python -m pip install --pre positorium
A small example:
import positorium
with positorium.Database.memory() as database:
result = database.execute_one(
"""
add role organization, risk_assessment;
add posit
[{(+company, organization)}, "Northstar Trading", @NOW],
[{(company, risk_assessment)}, "high risk", '2026-01-12'],
[{(company, risk_assessment)}, "needs review", '2026-01-12'];
search
[{(?company, organization)}, ?organization, *],
[{(?company, risk_assessment)}, ?assessment, *]
return ?organization, ?assessment;
"""
)
for row in result.to_dicts(text=True):
print(row)
This returns both assessments rather than choosing a winner or overwriting one of them.
Positorium is still an early beta and is intended for evaluation rather than production deployment. Wheels are available for CPython 3.9+ on Linux, macOS, and Windows.
If you have a small dataset where sources conflict or corrections matter, try the beta: