> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Redshift Data Get Statement Result V2

Fetch the temporarily cached result of a SQL statement that was run through the Redshift Data API, together with the metadata of its columns.

**Note**: the statement must have been run with `Result Format` set to `CSV` - this action cannot fetch the results of a statement that ran with the default `JSON` format. Each returned record holds rows in CSV format.

Results are paginated. When the response contains a `NextToken`, run the action again with that value in `Next Token` to fetch the next page.

<Note>
  External Documentation

  To learn more, visit the [AWS documentation](https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_GetStatementResultV2.html).
</Note>

## Basic Parameters

<div className="integrations-table">
  | Parameter         | Description                                                                                                                                                                                                                                                                                                                                                         |
  | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | AWS Region        | The AWS Region of the Redshift cluster or Serverless workgroup.                                                                                                                                                                                                                                                                                                     |
  | Next Token        | The pagination token for fetching the next page of records, taken from the `NextToken` field of a previous response.<br /><br />Leave empty to fetch the first page.                                                                                                                                                                                                |
  | Statement ID      | The identifier of the SQL statement whose results are to be fetched.<br /><br />Can be obtained using the `Redshift Data Execute Statement` or `Redshift Data List Statements` action.<br /><br />A `:<number>` suffix indicates a specific statement of a batch query. For example, `d9b6c0c9-0747-4bf4-b142-e8883122f766:2` is the second statement of the batch. |
  | Wait Time Seconds | The number of seconds to wait for the SQL statement to finish before the API returns a response.<br /><br />Valid values range from `1` to `30`.                                                                                                                                                                                                                    |
</div>

## Advanced Parameters

<div className="integrations-table">
  | Parameter                        | Description                                                                   |
  | -------------------------------- | ----------------------------------------------------------------------------- |
  | Disable XML To JSON Auto Convert | When checked, XML responses are not automatically converted into JSON format. |
</div>

## Example Output

```json theme={"dark"}
{
	"ColumnMetadata": [
		{
			"isCaseSensitive": false,
			"isCurrency": false,
			"isSigned": true,
			"label": "id",
			"length": 0,
			"name": "id",
			"nullable": 1,
			"precision": 10,
			"scale": 0,
			"schemaName": "public",
			"tableName": "users",
			"typeName": "int4"
		}
	],
	"NextToken": "",
	"Records": [
		{
			"CSVRecords": "1,Jane Smith\n2,Bob Johnson\n"
		}
	],
	"ResultFormat": "CSV",
	"TotalNumRows": 2
}
```

## Workflow Library Example

[Redshift Data Get Statement Result V2 with Aws and Send Results Via Email](https://library.blinkops.com/workflows/redshift-data-get-statement-result-v2-with-aws-and-send-results-via-email)

<div className="iframe-wrapper">
  <div className="iframe-media">
    <img src="https://mintcdn.com/blinkops-2/ojHYuDeYX5FWuN8a/img/Icons/play-box.svg?fit=max&auto=format&n=ojHYuDeYX5FWuN8a&q=85&s=b8af968e71438a9499c3223c9bd29fb2" alt="Workflow Library" width="16" height="16" data-path="img/Icons/play-box.svg" />

    Preview this Workflow on desktop
  </div>

  <iframe className="iframe" src="https://library.blinkops.com/workflows/redshift-data-get-statement-result-v2-with-aws-and-send-results-via-email/canvas" />
</div>
