Repository navigation
v0.0.1
🚀 Added
models:BaseSQLModel, the base of the table models, generic over the entity a row is read into. The table is named after the class in snake case,to_entity()/from_entity()map a row to its entity and back, and every model shares onemetadatawhose naming convention gives every constraint and index a stable name.DATETIME_TZandJSONBcolumn types,CreatedDateMixin/UpdatedDateMixin/DatesMixin.filters:FilterParams, the query contract of a model, built from a declaration of the filter fields with their lookups (exact,iexact,ne,in,not_in,isnull,lt,lte,gt,gte,contains,icontains,startswith,istartswith,endswith,iendswith), the ordering fields and the search fields.UpdateParams, the contract of the columns an update may set.FilterSetruns them on anAsyncSession:select()returns a page with both keyset cursors (the key is the ordering plus the primary key, anchored by one row-value comparison, with anOFFSETfallback for a jump to a page),count()the number of matching rows,update_by_filters()updates everything matching in one statement or, with a limit, batch by batch withFOR UPDATE SKIP LOCKED.pagination:QueryParams, the query of an HTTP list endpoint built from aFilterParams(filter[...]fields,page,limit,cursor,ordering,search),PaginationandPaginatedResponse, the answer.
Python 3.11 to 3.15, sqlmodel >= 0.0.37, < 0.0.51, sqlalchemy[asyncio] >= 2.0.14, < 2.2. The SQL is PostgreSQL's.
Full Changelog: https://github.com/davyddd/ddsqlmodel/commits/v0.0.1