Skip to content

Usage¤

This section is a practical, task-oriented tour of tinydantic — from installation to defining models, storing and querying documents, and wiring tinydantic into real applications. Every code example on these pages is executed as a doctest in CI, so what you read is exactly what the library does.

  • Introduction — what tinydantic is and how it relates to TinyDB and Pydantic.
  • Installation — installing tinydantic from PyPI.
  • Quickstart — the shortest path from an empty database to inserting, reading, updating, and deleting a document.
  • CRUD tour — a reference-style walkthrough of every create, read, update, and delete method, including the sharp edges worth knowing about.
  • Queries — building TinyDB queries from model fields: comparisons, logical composition, nested fields, and static type checking with q().
  • Models — defining document models and getting the most out of Pydantic.
  • Storage — choosing and configuring TinyDB storage backends.
  • Configuration — binding models to databases and tables.
  • Testing — patterns for testing code that uses tinydantic.
  • FastAPI — using tinydantic models in a FastAPI application.