Skip to content

TinyMongo 1.3.1

Latest

Choose a tag to compare

@schapman1974 schapman1974 released this 21 Sep 21:31

TinyMongo 1.3.1 improves SQLite query performance and portability, fixes MongoDB compatibility gaps, and reduces JSON/memory write overhead. These changes are relative to the published 1.3.0 package and v1.3.0 tag.

python -m pip install --upgrade "tinymongo==1.3.1"

Changes since 1.3.0

  • SQLite indexed reads now narrow candidates for BSON scalar equality and $in, standalone date and numeric ranges, and $or when every branch has a safe indexed source. Exact BSON matching and array semantics remain authoritative; unsupported shapes retain conservative fallback.
  • Read-created BSON/date indexes now use stored keys, native indexes, and SQL invalidation triggers instead of requiring a Python function in the SQLite schema. This restores plain SQLite maintenance and compatibility with pre-#179 writers. Later reads refresh keys invalidated by writes.
  • Compound indexes consistently reject parallel arrays, including Python tuples, with code 171. Partial-index validation now distinguishes malformed/unknown predicates (2), non-mapping filters (14), and valid but prohibited predicates (67); empty partial filters are accepted.
  • NUL-containing field names are rejected recursively. PostgreSQL JSONB's refusal of NUL string values becomes a catchable InvalidDocument; that backend limitation remains documented.
  • SQLite/sharded SQLite updates avoid full uniqueness scans when index tokens are unchanged. JSON/memory ID merging no longer performs quadratic comparisons, although database-wide copying/serialization costs remain.

Michael Kennedy confirmed the final SQLite fixes with 903 passing application tests, zero query-narrowing bugs, and zero MongoDB divergences in his 45-shape comparison. His separate application type-checker gate remained unrelated to TinyMongo. Acceptance results.

Upgrading SQLite stores that ran PR #179

Stop or upgrade every original #179 (a54a8ec) reader and writer sharing a direct SQLite store before resuming traffic. A single stale read can recreate the incompatible legacy index. With 1.3.1, reopen each affected database and perform a storage operation such as client[database_name].list_collection_names() to remove owned legacy indexes; constructing a client alone is insufficient. Pre-#179 writers can remain. Explicit unique/partial indexes retain their separate SQLite function requirements.

Budget for first-use key construction and warm critical reads before serving traffic. Michael's cold read rose from 199.83 to 1,386.07 ms on a 200 MiB synthetic collection and from 380.29 to 760.54 ms on the real opt_ins range; warm reads stayed similar at 63.81 and 4.49 ms respectively. These are workload measurements, not latency guarantees. Upgrade steps · Tested warm-up example · Cold/warm measurements.

Python and platform support

Python 3.9+; CI covers standard CPython 3.9–3.14 on Linux and built-wheel checks on Windows x64, macOS Intel, and macOS Apple silicon. Free-threaded CPython 3.14 support remains beta through the documented free-threaded extra; DuckDB/Parquet are excluded from that profile. The sharded SQLite backend remains experimental and was already included in 1.3.0.

Full changelog: 1.3.0 → 1.3.1. For users following GitHub Releases, whose previous entry was 1.2.0: 1.2.0 → 1.3.1.