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
| Module | Import | Description |
|---|---|---|
sqliter | from sqliter import SqliterDB | Main database class |
sqliter.model | from sqliter.model import BaseDBModel | Base model (legacy mode) |
sqliter.model | from sqliter.model import unique | Unique constraint helper |
sqliter.model | from sqliter.model import ForeignKey | Foreign key factory (legacy mode) |
sqliter.orm | from sqliter.orm import BaseDBModel | Base model (ORM mode) |
sqliter.orm | from sqliter.orm import ForeignKey | Foreign key descriptor (ORM mode) |
sqliter.orm | from sqliter.orm import ManyToMany | Many-to-many descriptor (ORM mode) |
sqliter.orm | from sqliter.orm import ModelRegistry | Model registry |
sqliter.query | (internal) | QueryBuilder (returned by db.select()) |
sqliter.exceptions | from 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,ForeignKeyInfodataclass, andFKActiontype alias (legacy mode).
- ORM Mode -- Extended
BaseDBModelwith lazy loading,ForeignKeydescriptor,LazyLoader,ModelRegistry,ReverseQuery, andReverseRelationship.
- Many-to-Many --
ManyToManydescriptor,ManyToManyManagerAPI, reverse accessors, and junction tables.
- Exceptions -- Full hierarchy of 17 exception classes with message templates and usage context.
- Helpers & Constants -- Internal utility functions and constant mappings used by the library.