How to batch process using temporal worflow with database calls

I have following scenario which I am trying to achieve using temporal
Since database calls are not allowed in workflow how can I achieve this.

  1. Get all users from database (needs to fetch with pagination, as it can be large)
  2. For each user find list of items (come from db) associated with it (again items will be paginated)
  3. For each item execute time consuming operation.

I know I can create workflow which will take userId, itemId as input and then execute expensive operation inside activity.

What I am not sure of is how to iterate in batches without writing db call in some parent workflow?

Look at the batch samples and see if you can construct your solution based on them.

Thanks, will try it

Thanks, this examples were helpful to create paginated workflow