Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-48173: Add abstraction for counted paginated queries #357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rra
Copy link
Member

@rra rra commented Dec 16, 2024

PaginatedQueryRunner has a separate query_count method to return the count, but since the total entry count isn't included in the PaginatedList data structure, it's annoying to pass between components of a service. Either the result plus the count have to be returned as a tuple, or the service has to add its own data structure to wrap PaginatedList.

Avoid this by introducing a CountedPaginatedQueryRunner and a corresponding CountedPaginatedList that always includes a count attribute. This can be used by services such as Gafaelfawr that always want to count the total number of entries, either because the table is small or because the count can always be satisfied from the table indices.

`PaginatedQueryRunner` has a separate `query_count` method to return
the count, but since the total entry count isn't included in the
`PaginatedList` data structure, it's annoying to pass between
components of a service. Either the result plus the count have to be
returned as a tuple, or the service has to add its own data structure
to wrap `PaginatedList`.

Avoid this by introducing a `CountedPaginatedQueryRunner` and a
corresponding `CountedPaginatedList` that always includes a `count`
attribute. This can be used by services such as Gafaelfawr that always
want to count the total number of entries, either because the table
is small or because the count can always be satisfied from the table
indices.
@rra
Copy link
Member Author

rra commented Dec 17, 2024

Tested in lsst-sqre/gafaelfawr#1187

@rra rra requested a review from fajpunk December 17, 2024 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant