Skip to content

v0.0.1

Choose a tag to compare

@github-actions github-actions released this 28 Nov 15:55
· 4 commits to main since this release

🚀 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