Changelog¤
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.4.0 - 2026-07-10¤
Changed¤
- BREAKING:
insert_multiple()now mirrorsinsert(): each passed-in model'sidis set in place to the id TinyDB assigned, and the same instances are returned in insertion order (list[Self], previouslylist[int]). Read ids from the returned models'idattributes. - BREAKING:
update()andupdate_multiple()now give mapping values the same treatmentinsert()andsave()give whole models: values that name model fields are validated against the field's type (invalid values raisepydantic.ValidationError) and serialized to JSON-safe primitives before reaching storage, so rich values such asdatetimeround-trip instead of corrupting JSON storage. Keys that are not model fields, and transform callables, pass through unchanged. - BREAKING:
DocumentNotFoundErrorandDocumentIDRequiredErrornow take keyword arguments when constructed directly, and their messages name the model, table, document id, and operation (for exampleNo document with id 42 in table 'books' (model 'Book')).
Added¤
get_or_raise()— the strict counterpart toget(): fetches a single document by condition ordoc_idand raisesDocumentNotFoundErrorinstead of returningNonewhen no document matches.count()can now be called with no arguments to count all documents in the table.q()now accepts a field name as a string (q("search") == "fuzzy"), the escape hatch for querying fields whose names collide with model methods such assearchorget.
0.3.1 - 2026-07-09¤
Added¤
PYTHON_OBJECTS_INV,PYDANTIC_OBJECTS_INV, andTINYDB_OBJECTS_INVenvironment variables that point the documentation build at local copies of the corresponding Sphinx object inventories, as a workaround for bot challenges (such as Read the Docs' Cloudflare challenge) rejecting mkdocstrings' inventory downloads.
0.3.0 - 2026-07-09¤
Added¤
- Support for Python 3.10.
0.2.0 - 2026-07-06¤
Changed¤
- BREAKING: The base class is now
TinydanticModel(previouslyDocument). Configure it with class keyword arguments—database=andtable_name=—and rebind a model to a different database at runtime withbind(). - BREAKING: A document's
idis now included inmodel_dump(), and stored documents are serialized in JSON mode. Callingsave()on an instance that has never been persisted now inserts it. - BREAKING:
get()selector arguments have been renamed todoc_idanddoc_idsand are now keyword-only. Passing more than one selector raisesValueError, andget(doc_ids=...)returns alist[Self], silently skipping any ids that are not found. - BREAKING: The minimum supported Python version is now 3.11 (previously 3.8). PyPy is no longer claimed as a supported runtime.
- BREAKING:
DocumentIDRequiredErrorno longer subclassesValueError. All library exceptions now derive from a commonTinydanticErrorbase. - Tooling: the project build backend moved from hatch to uv with
poethepoettask running anduv_build(versioning is now static, managed by commitizen); the documentation engine is now ProperDocs, and the docs site gained eight new usage pages.
Added¤
- A full Table API surface:
search,contains,update,update_multiple,upsert, andremove. - A
delete()method for removing documents. - Convenience lookups:
get_by_cond,get_by_id, andget_by_ids. - A
q()query helper. - Error classes are now exported from the package root.
- A
py.typedmarker so downstream type checkers pick up tinydantic's type hints.
Fixed¤
save()no longer crashes when called on an instance that has not yet been persisted.replace()no longer leaks aKeyErrorwhen the target document does not exist.datetime,UUID, and nested model fields now round-trip correctly through storage.