-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Cosmos: add support for pagination #24513
Comments
Also consider exposing the continuation token
|
/cc @roji |
It seems like we should have both a per-query setting and a global context option default (like non-tracked). Some theoretical thoughts:
|
Very interested in this - currently using EFCore + Cosmos provider in a Blazor Server application and there isn't a very scalable way I can find to offer paging without being able to use the continuation token |
Very interested in this as well. We are using EF Core Cosmos provider at the moment and the only way to query a page is to use the 'skip and take' approach. But as it has been mentioned, it's going to use more RUs for the next pages. So we started thinking about using .NET SDK and replacing EF queries with Cosmos continuation tokens |
Any updates? I am also having to shelve EF w/ Cosmos because of this limitation. |
This feature hasn't been assigned to a particular release yet. The best way to indicate the importance of an issue is to vote (👍) for it. This data will then feed into the planning process for the next release. |
Current design proposal: public static Task<Page<TSource>> ToPageAsync<TSource>(
this IQueryable<TSource> source,
string? continuationToken = null,
int? maxItemCount = null,
int? continuationTokenLimitInKb = null,
CancellationToken cancellationToken = default)
public static IQueryable<TSource> WithMaxItemCount<TSource>(
this IQueryable<TSource> source,
int maxItemCount) See Page<T> Open questions:
|
Thanks @AndriySvyryd, was not aware of this API! |
Note the conceptually somewhat similar LINQ Chunk API which was recently added. Of course, that has no notion of a continuation token, so is less useful. |
BTW we could even consider providing some sort of similar "pageability" on relational databases via keyset pagination, where the sorting key(s) would be somehow encoded as the continuation token which the user can extract and pass back. |
Updated the proposal based on the discussion. If we implement pagination on other providers the API will be separate, even if the general shape is the same, to allow exposing provider-specific options. |
BTW I think it does make sense to accept the maxItemCount directly in ToPageAsync, just to not force the user to use two different operators (it could override any previous-specified one). But we can figure all that out later. |
It would be good if you used the same patter, or even the same pagination API as in the Azure SDK (or System.ClientModel). |
@KrzysztofCwalina yeah, we haven't yet started designing for this, but these are on my radar. Are you refering specifically to these recently-merged paging abstractions, or anything else? |
@roji, we are iterating to finalize those abstractions now in advance of the next GA of System.ClientModel. If those or the similar types in Azure.Core don't meet your requirements but you'd be open to using them if they did, it would be helpful to us to understand your requirements so we could consider including them in the SCM abstractions with a goal to minimize API surface for users. |
Sounds good! I'll try to prioritize working on the pagination bits sooner rather than later, and will be in touch with the results. Who are the relevant people to ping on both System.ClientModel and the Azure SDKs, apart from you two? |
@KrzysztofCwalina and I are a great place to start and we can loop in anyone else whose perspective we need. Many thanks! |
See https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.queryrequestoptions.maxitemcount?view=azure-dotnet
The text was updated successfully, but these errors were encountered: