Repository navigation
Releases
Releases · davyddd/ddsqlmodel
v0.0.2
🔄 Changed
- An
orderingis taken only from the contract: one ofordering_fields, in either direction, or thedefault_orderingitself. A contract withoutordering_fieldsused to accept anyordering, sort the list by whatever column of the model it named and write the values of that column into the cursors; it now refuses one withValueError. Lists built onQueryParamswere never affected: it passes an ordering only for a contract that declares ordering fields.
🐛 Fixed
- An
EXACTsearch skips an integer column when the term is a number out of the range of the column's type. The database refused the whole statement for such a number: a phone number typed into the search of a list with anintsearch field ended in an error. - An
EXACTsearch skips aDecimalcolumn for a term that is no number, and a cursor with such a value is refused as malformed withValueError. Both raiseddecimal.InvalidOperation.
Full Changelog: v0.0.1...v0.0.2
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