I need to implement pagination with sorting by start/end time, status and filtering by status and workflow id prefix for workflow executions.
I found, that I can implement filtering using query parameter of ListWorkflowExecutions.
Also, I found that there was possible to have ORDER BY clause in the ListWorkflowExecutions (@tihomir Mentioned it here 2 years ago)
But now (1.24.2.1) adding ORDER BY and LIMIT clauses are not supported (source code)
My question is: is there any way to implement pagination with sorting and filtering using out of the box functionality?
Also, I noticed, that temporal web provides frontend based pagination (load all and split to pages on UI). This won’t work for my case
P.S.: I am really struggling when try to understand capabilities of API.
Can’t find single source of truth about the API and answers for simple questions like “what is the default sorting for ListWorkflowExecutions?”. Have to dig forums, examples, documentation for different languages and cli, and even source code of the temporal.
It would be really helpful to have something similar to OAS spec for Temporal APIs
Also, I found that there was possible to have ORDER BY clause in the ListWorkflowExecutions (@tihomir Mentioned it here 2 years ago)
But now (1.24.2.1) adding ORDER BY and LIMIT clauses are not supported (source code)
correct, it was disabled by default as custom ordering by is pretty heavy operation. you can still enabled it via dynamic config
system.visibilityDisableOrderByClause
(set it to false)
but its recommended to use mentioned default sort order instead if possible
I need to implement pagination with sorting by start/end time, status and filtering by status and workflow id prefix for workflow executions.
not sure whats the issue here, you can filter by StartTime / CloseTime, ExecutionStatus and WorkflowId STARTS_WITH works too
do you have custom rules for pagination? default page size is 1K and you can change that via dynamic config frontend.visibilityMaxPageSize
if you want to cap it to something smaller. most visibility apis also allow you to specify smaller page size than the cap you define in dynamic config
The issue is that temporal API doesn’t support limit/offset.
This mean, if I need to implement 30 rows per page pagination and user wants to access page â„–15:
if frontend.visibilityMaxPageSize = 1000
need to make page request, retrieve 970 unneeded rows of data, filter them out, return result to user
if frontend.visibilityMaxPageSize = 30
need to make 15 page request (because next token is required to retrieve next page).