Reference#
Hand-crafted API reference covering every public export of pgdorm, pgdorm.typing, pgdorm.migrate, pgdorm.testing, and the pgdorm CLI. Signatures are checked against the source on every build, and symbol coverage is verified bidirectionally against each package's __all__.
For concepts, tutorials, and end-to-end walkthroughs, start with First Shift or The Elephant Dormitory Story.
Layered Public Packages#
| Package | Purpose | Reference Page |
|---|---|---|
pgdorm |
Core ORM surface: models, types, query/DML builders, expressions, runtime pool, and typed exceptions | Models & Types, Queries & DML, Expressions & Functions, Runtime & Pool, Errors & Linters |
pgdorm.typing |
Strictly typed protocols, type aliases, and helper types (zero runtime helper functions) | Typing |
pgdorm.migrate |
Online schema migrations, AST diffing, lock-timeout guards, and rollback planning | Migrations |
pgdorm.testing |
Zero-mock test helpers, PostgreSQL container factories, and schema isolation fixtures | Testing |
pgdorm CLI |
Command-line migration runner, schema inspection, and doctor diagnostics |
CLI |
Type-Checker Guarantees#
The public API is written in modern, fully annotated Python and checked in strict mode, so standard type checkers infer precise types with no stubs or plugins.
All Table subclasses are slot-backed (__slots__, zero __dict__), query builders propagate row and column types through Select[T], Executable[RetT], and ReadQuery[RetT], and read-only pools (ReadPool / ReadTransaction) statically reject write statements at type-check time.
Machine-Readable Indexes#
/pgdorm/llms.txt— Concise site map and API overview for LLM agents/pgdorm/llms-full.txt— Full concatenated documentation corpus
Reference Pages#
- Models & Types —
Table,TypeTable,Col, column/constraint descriptors,Registry,Create/PatchDTOs, PostgreSQL type markers,Range, JSON/FTS types, ERD export, and version helpers. - Queries & DML —
select,insert,insert_many,insert_subtype,update,delete,merge,RETURNING, CTEs,LATERALjoins, set operations, subqueries,compile,prepare, andResultRow. - Expressions & Functions —
Expr,OrderSpec,param,lit,func,cast,case, aggregates, grouping sets, window functions & frames, full-text search, and JSONB/SQL-JSON helpers. - Runtime & Pool —
Pool,ReadPool,Connection,Transaction,Pipeline,RowStream,ArrowStream,SplitResult,Listener,ExplainPlan,Trace,TelemetryHook, anddoctor. - Errors & Linters —
PgdormErrorhierarchy, schema/join/DML linters, and typed PostgreSQL SQLSTATE exceptions with retryability rules. - Typing — Public protocols, type aliases, and generic bounds in
pgdorm.typing. - Migrations —
pgdorm.migrateschema snapshots, diffs, operations, and online migration runner. - Testing —
pgdorm.testingcontainer helpers and database fixtures. - CLI —
pgdormcommand-line subcommands and flags.