Skip to main content

Query Batch Data

Controlled node

Overview​

Read the database rows assigned to each worker.

Query Batch Data reads a worker's share of a project database table. Use it in the workflow assigned to a batch step in a job flow.

Set Batch runs on the step to choose the number of workers. Each worker runs the same workflow, and this node divides the matching rows between them. You do not need to choose a fixed number of rows per worker.

For example, with 100 matching rows and four workers, each worker receives 25 rows. Shares may differ when the rows do not divide evenly, and some workers may have no rows. The worker count does not guarantee that all workers execute simultaneously.

Properties​

Select the node to configure these settings in its properties panel. They are not data input sockets.

PropertyTypeDescriptionDefault
databaseIdDatabaseChoose a Database containing the data. The adjacent icon opens it.-
tableIdTableChoose a table. Refresh if a newly created table is missing.-
filterFilterOptional conditions selecting eligible rows. Without a filter, all rows are eligible.-

Changing the database clears the selected table and filter. Changing the table clears the filter.

Inputs​

InputTypeDescription
runEventFetches the current worker's share of the matching rows.

Outputs​

OutputTypeDescription
dataDataA list of row objects, null when this worker has no rows, or an object with an error field if the query cannot be completed.
doneEventFires when the node finishes, including when it returns no rows or an error object.

Check data before processing it. done means the query attempt has finished, not that rows were successfully returned.

Use it in a batch step​

  1. Add a batch step to a job flow, choose its workflow and set Batch runs to your worker count.
  2. In that workflow, add Query Batch Data and select the database, table and optional filter.
  3. Connect Start to the node's run input.
  4. From done, check for an error or an empty result before continuing.
  5. For a list of rows, connect data to object on For Each and trigger its run input. Use loop and element to process each row.
  6. Continue after For Each finishes if you need to return results or perform a final action for that worker.

To count the rows actually returned, pass the list to Length. Batch Length counts workers, not rows.

Testing in the editor​

An ordinary editor run uses one worker with index 0, so the node returns all matching rows. It does not automatically limit the result to a small preview.

Use a small test table or a restrictive filter, particularly if downstream nodes send messages, change records or incur usage costs. Then test the job with the intended worker count.

Outside the editor, the node needs the context supplied by a batch step. Running it through a normal API call or a single-run step without that context returns an error object.

Keep the matching rows stable​

Each worker queries the current table. Keep the set of matching rows unchanged until the batch step finishes: adding or deleting rows, or changing values used by the filter, can cause later workers to skip or repeat records.

For example, if you filter on status = pending, changing rows to complete while other workers are still fetching their shares changes the dataset they see. Use a stable selection for the step, or make those changes afterward.

This node distributes rows; it does not claim work items or prevent repeated side effects if you rerun the job. Design writes and external actions with retries in mind.