Read-only access to RootsMagic (.rmtree) SQLite databases, with a couple of CLI tools for the common queries. Designed for actual research use: cite-first, provenance over polish, no third-party dependencies.
rmread is a Python library plus two CLI commands that read from RootsMagic 7+ databases (verified against RM 11.0) without modifying them. It uses only the Python standard library — sqlite3, dataclasses, argparse.
- Read-only — always opens with
mode=roplusPRAGMA query_only. A stray write raises rather than mutating research data. - Standard library only — no
requirements.txt, no install dance beyondpip install -e . - Evidence-grade — output carries source citations, never just “person @pid7 was born in FFakePlace-1”.
For the project’s sourcing rules and what “evidence-grade” means in
practice, see AGENTS.md and references/evidence-discipline.md.
- Not a Root-aware editor. rmread will not change anything in your
.rmtree, ever. - Not a genealogical-format converter. GEDCOM / Gramps interop belongs in a sibling tool, not this one.
- Not built for parallel scanning. One SQLite connection per process is fine for real-world trees (100k+ persons run in a second or two); for genuinely big data, look elsewhere.
git clone https://github.com/tmills80/rmread.git
cd rmread
python -m venv .venv
source .venv/bin/activate
pip install -e ".[test]"(test pulls in pytest. The library itself has no third-party
runtime dependencies.)
rmread is not published to PyPI yet. It is the dependency of
rm2gramps, which lives in a sibling repository and resolves it from
a checkout next door:
uv sync --all-extrasrm-find Tree.rmtree AAAAAA # surname search
rm-dump Tree.rmtree 1 # full person recordBoth commands print to stdout and metadata to stderr. Pipe at will:
rm-find Tree.rmtree AAAAAA --format json --limit 10 | jq '.results[].primary_name.surname'
rm-dump Tree.rmtree 7 --format json > person-7.jsonrm-find Tree.rmtree AAAAAA # substring (default)
rm-find Tree.rmtree 'AAA%' # wildcard (LIKE)
rm-find Tree.rmtree AAAAAA --exact # literal match, no % wrap
rm-find Tree.rmtree 'AAA%' --given FridaBoth surname and --given are SQL LIKE patterns, case-insensitive:
| Pattern | Matches |
|---|---|
AAAAAA | the literal substring AAAAAA (auto-wrapped as %AAAAAA% when no wildcards present) |
'AAA%' | names starting with AAA (AAABBB, AAAAAA, AAAxxx, …) |
'A_AAA' | AAAAAA, ABAAAA, ACAAAA, A0AAAA, … (_ = exactly one char) |
'%AAAA%' | names containing AAAA anywhere |
Pass --exact when you want exactly the value you typed — useful when
the surname genuinely contains % or _ as literal characters.
Output formats
text(default) — fixed-column table, one row per person. Designed for reading; truncates long fields with….json— envelope-stamped JSON suitable for piping or scripted downstream use.
{
"envelope": {
"tool": "rmread",
"schema_version": 1,
"source_database": "Tree.rmtree",
"db_version": 11000,
"count": 1
},
"results": [
{
"person_id": 5,
"unique_id": "...",
"sex": 1,
"living": false,
"is_private": false,
"primary_name": { "surname": "...", "given": "...", "...": "..." }
}
]
}The source_database and db_version stamps let a downstream tool
verify provenance without trusting the caller.
The schema_version stamp says which shape the payload under the
envelope has. rm-find and rm-dump emit different shapes, so they
carry different versions (rmread.format.FIND_SCHEMA_VERSION and
rmread.format.DUMP_SCHEMA_VERSION, both currently 1). A consumer
that does not recognise the version must refuse the payload rather
than guess at it.
rm-dump Tree.rmtree 7 # everything
rm-dump Tree.rmtree 7 --format json # as JSON
rm-dump Tree.rmtree 7 --no-events # identity + family only
rm-dump Tree.rmtree 7 --no-family # identity + events onlyDumps everything rmread knows about a single PersonID: identity,
recorded life events (birth / death / burial / christening /
baptism / cremation / occupation / census / probate / will /
residence by default), parents, spouses, children.
--format json emits the same envelope, stamped with
rmread.format.DUMP_SCHEMA_VERSION:
{
"envelope": {
"tool": "rmread",
"schema_version": 1,
"source_database": "Tree.rmtree",
"db_version": 11000,
"person_id": 7
},
"result": {
"person": { "...": "..." },
"events": [ { "...": "..." } ],
"parents": [ { "...": "..." } ],
"spouses": [ { "...": "..." } ],
"children": [ { "...": "..." } ]
}
}rmcite consumes this shape. The contract is guarded by
the rmcite package’s tests/test_contract.py, which asserts that
rmcite’s pinned SUPPORTED_SCHEMA_VERSION still equals
rmread.format.DUMP_SCHEMA_VERSION.
Exit codes
| Code | Meaning |
|---|---|
0 | Found and rendered |
1 | No such PersonID in this database |
2 | File missing or not a valid RootsMagic SQLite file |
Exit codes are stable — script away.
from rmread import open_database, find_by_surname, dump_person
with open_database("Tree.rmtree") as db:
print(f"RM version: {db.version}")
# Library queries always go through db.con, the underlying
# read-only sqlite3.Connection. Direct SQL is fine; the rest of
# the package is just convenience around it.
people = find_by_surname(db.con, "AAAAAA")
for p in people:
print(p.person_id, p.display_name)
# Full person record — identity + events + parents/spouses/children.
dump = dump_person(db.con, people[0].person_id)
for ev in dump.events:
print(f" {ev.event_type_name}: {ev.date} at {ev.place}")The public dataclass surface:
Name,Person,PersonDump— peopleEvent,DEFAULT_EVENT_TYPES— life factsParentRef,SpouseLink,ChildRef— family links
All dataclasses are frozen and hashable so they can go in sets or be keys.
- Never commit a *.rmtree file.*
.gitignoreat the repo root excludes*.rmtreeand*.rmgc. Real RootsMagic databases contain living-people records and are not version-controlled here. - Use synthetic data in tests. The test suite in this repo does
not open a real
.rmtree. If you fork or copy the library, preserve that. - Cross-vault matches are not kinship. Like any RootsMagic query,
same-surname hits in different researcher vaults ≠ same family.
See
references/evidence-discipline.md§3.
docs/rm11-schema.md— RM 11.0 SQLite schema reference. Full column lists for every.rmtreetable, verified event-type IDs, theRMNOCASEcollation footgun, link-tableOwnerTypeconventions, and the bug list verified againstSampleTree.rmtree.docs/scaffolding-context.md— project-local guidance (synthetic-data rules, parents-vs-co-parents, read-only safeguards).references/evidence-discipline.md— the sourcing rules.
MIT. See LICENSE.