run_id it returns. This gives you a run you triggered and can poll for, so you always fetch results from a run whose status you know is success.
Scheduled query runs are best suited for viewing data in the Allium App. Get latest run returns the most recent run regardless of status, so a failed scheduled refresh can shadow the last good dataset. Triggering your own run avoids this — you hold the
run_id and decide when the data is valid.The workflow
Run the query
Poll for status
Poll Fetch query run status with the Statuses
run_id until the status is terminal. Treat success as ready, and failed or canceled as a retry signal.created, queued, and running mean the run is still in progress — keep polling.Fetch results
Once the status is
success, call Fetch query run results with the same run_id to retrieve the dataset for the run you triggered.Example
run_id for the entire loop, you never depend on the latest run being the one you want, and you don’t need a separate store to track run statuses or preserve the last successful run.