Skip to content

API Reference

This section provides detailed documentation for every public class, method, property, function, and constant in the SQLiter library. Each entry includes the full signature, parameter descriptions, return types, and usage examples.

Tip

If you are new to SQLiter, start with the Guide for a tutorial-style introduction. This API Reference is intended as a comprehensive lookup resource.

Module Overview

ModuleImportDescription
sqliterfrom sqliter import SqliterDBMain database class
sqliter.modelfrom sqliter.model import BaseDBModelBase model (legacy mode)
sqliter.modelfrom sqliter.model import uniqueUnique constraint helper
sqliter.modelfrom sqliter.model import ForeignKeyForeign key factory (legacy mode)
sqliter.ormfrom sqliter.orm import BaseDBModelBase model (ORM mode)
sqliter.ormfrom sqliter.orm import ForeignKeyForeign key descriptor (ORM mode)
sqliter.ormfrom sqliter.orm import ManyToManyMany-to-many descriptor (ORM mode)
sqliter.ormfrom sqliter.orm import ModelRegistryModel registry
sqliter.query(internal)QueryBuilder (returned by db.select())
sqliter.exceptionsfrom sqliter.exceptions import ...Exception hierarchy
sqliter.helpers(internal)Utility functions
sqliter.constants(internal)Constant mappings

Note

The ORM module (sqliter.orm) is an alternative import mode that extends the legacy sqliter.model with lazy loading and reverse relationships. See ORM Mode for details.

Pages

  • SqliterDB -- Main entry point for all database operations: connections, tables, CRUD, caching, and transactions.
  • BaseDBModel -- Pydantic-based base class for defining database models, plus the unique() constraint helper.
  • QueryBuilder -- Fluent API for filtering, ordering, paginating, and executing queries.
  • Foreign Keys -- ForeignKey() factory function, ForeignKeyInfo dataclass, and FKAction type alias (legacy mode).
  • ORM Mode -- Extended BaseDBModel with lazy loading, ForeignKey descriptor, LazyLoader, ModelRegistry, ReverseQuery, and ReverseRelationship.
  • Many-to-Many -- ManyToMany descriptor, ManyToManyManager API, reverse accessors, and junction tables.
  • Exceptions -- Full hierarchy of 17 exception classes with message templates and usage context.