Skip to content

Releases

v0.0.2

Choose a tag to compare

@github-actions github-actions released this 29 Nov 15:59
9198c0a

🔄 Changed

  • An ordering is taken only from the contract: one of ordering_fields, in either direction, or the default_ordering itself. A contract without ordering_fields used to accept any ordering, 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 with ValueError. Lists built on QueryParams were never affected: it passes an ordering only for a contract that declares ordering fields.

🐛 Fixed

  • An EXACT search 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 an int search field ended in an error.
  • An EXACT search skips a Decimal column for a term that is no number, and a cursor with such a value is refused as malformed with ValueError. Both raised decimal.InvalidOperation.

Full Changelog: v0.0.1...v0.0.2

v0.0.1

Choose a tag to compare

@github-actions github-actions released this 28 Nov 15:55

🚀 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 one metadata whose naming convention gives every constraint and index a stable name. DATETIME_TZ and JSONB column 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. FilterSet runs them on an AsyncSession: select() returns a page with both keyset cursors (the key is the ordering plus the primary key, anchored by one row-value comparison, with an OFFSET fallback 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 with FOR UPDATE SKIP LOCKED.
  • pagination: QueryParams, the query of an HTTP list endpoint built from a FilterParams (filter[...] fields, page, limit, cursor, ordering, search), Pagination and PaginatedResponse, 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