Releases: uriyyo/fastapi-pagination
Releases ยท uriyyo/fastapi-pagination
0.12.31
0.12.30
0.12.29
New Feature
sqlalchemy
unwrap_mode
allows you to control how to unwrap result rows before passing them to items transformer
and page creation.
unwrap_mode
can be set to one of the following values:
None
- will useauto
mode for default queries, andlegacy
fortext
andfrom_statement
queries."auto"
- will unwrap only in case if you are selecting single model."legacy"
- will use old behavior, where row will be unwrapped if it contains only one element."unwrap"
- will always unwrap row, even if it contains multiple elements."no-unwrap"
- will never unwrap row, even if it contains only one element.
0.12.28
- Add better logic for
sqlalchemy
scalars unwrapping. #1281 - Fix issue with
sqlalchemy
imports forgino
ext. #1282 - Fix issue with incorrect body schema. #1299
Breaking changes
sqlachemy
extension no longer requires to use items_transformer
when selecting scalar field:
This code is no longer valid:
paginate(session, select(User.name), transformer=lambda items: [{'name': item} for item in items])
The correct version now is:
paginate(session, select(User.name))
0.12.27
0.12.26
- Fix issue with passing
count_query
intosqlalchemy
/sqlmodel
. #1194 - Add ability to use async
length_function
withasync_paginator
. #1204 - Fix incorrect total number in page when paginating
beanie
query withfetch_links=True
. #1199
Thanks to @moumoutte and @IterableTrucks!
0.12.25
0.12.24
0.12.23
- Add limit to CursorParams.size field. #1119
- Strip extra lines before and after the
_WARNING_MSG
. #1117
Thanks to @barsikus007 and @frost-nzcr4!
Breaking changes:
CursorPage
now has default upper limit for size
query param (size should be <= 100).
If you want to remove this restriction and use old behavior, you can customize CursorPage
:
from fastapi_pagination.cursor import CursorPage as BaseCursorPage
from fastapi_pagination.customization import UseParamsFields, CustomizedPage
CursorPage = CustomizedPage[
BaseCursorPage,
UseParamsFields(
size=Query(50, ge=0),
),
]