Skip to main content

Query resources with the Resource query block

Learn how to interact with data sources in a workflow.

tip

Learn more about Retool's built-in API and database integrations, and how to connect your own data sources.

You can add Resource query blocks to workflows that enable you to write queries that interact with the resources in your Retool organization, such as SQL databases or APIs.

The available options in a Resource query block depend upon the selected resource. For example, if you select a PostgreSQL database then you can write SQL statements or use GUI mode to construct queries that write or modify data.

OAuth resources and workflows

If your resource uses OAuth, make sure Share credentials between users is enabled on the resource configuration page. This ensures workflows run automatically.

Configure block settings

You can configure the following settings for Resource query blocks.

Timeout after (ms)

The duration to wait before the block times out. Default is 10000.

Retry count

The maximum number of attempts to retry the query if an error is returned.

Interval

The minimum length of time to wait between query retries. This is useful if a query is triggering a rate limit.

Exponential

Whether to increase the interval between retries, also known as exponential backoff. This is useful for handling rate limits.

Finally

Whether to stop the workflow and return an error if the block fails, or continue to allow an error handler to run.

Coefficient

When exponential backoff is enabled, the constant factor by which the time delay between retry attempts increases after each failure.

Max interval

When exponential backoff is enabled, the maximum time to delay between retries.