diff --git a/clients/client-redshift-data/README.md b/clients/client-redshift-data/README.md index 1f2743b77458..a76ef157cebb 100644 --- a/clients/client-redshift-data/README.md +++ b/clients/client-redshift-data/README.md @@ -14,7 +14,7 @@ can run SQL statements, which are committed if the statement succeeds.

## Installing -To install the this package, simply type add or install @aws-sdk/client-redshift-data +To install this package, simply type add or install @aws-sdk/client-redshift-data using your favorite package manager: - `npm install @aws-sdk/client-redshift-data` @@ -254,6 +254,14 @@ GetStatementResult [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/redshift-data/command/GetStatementResultCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift-data/Interface/GetStatementResultCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift-data/Interface/GetStatementResultCommandOutput/) + +
+ +GetStatementResultV2 + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/redshift-data/command/GetStatementResultV2Command/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift-data/Interface/GetStatementResultV2CommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift-data/Interface/GetStatementResultV2CommandOutput/) +
diff --git a/clients/client-redshift-data/src/RedshiftData.ts b/clients/client-redshift-data/src/RedshiftData.ts index 69276e917e36..c81391605069 100644 --- a/clients/client-redshift-data/src/RedshiftData.ts +++ b/clients/client-redshift-data/src/RedshiftData.ts @@ -32,6 +32,11 @@ import { GetStatementResultCommandInput, GetStatementResultCommandOutput, } from "./commands/GetStatementResultCommand"; +import { + GetStatementResultV2Command, + GetStatementResultV2CommandInput, + GetStatementResultV2CommandOutput, +} from "./commands/GetStatementResultV2Command"; import { ListDatabasesCommand, ListDatabasesCommandInput, @@ -53,6 +58,7 @@ const commands = { DescribeTableCommand, ExecuteStatementCommand, GetStatementResultCommand, + GetStatementResultV2Command, ListDatabasesCommand, ListSchemasCommand, ListStatementsCommand, @@ -153,6 +159,23 @@ export interface RedshiftData { cb: (err: any, data?: GetStatementResultCommandOutput) => void ): void; + /** + * @see {@link GetStatementResultV2Command} + */ + getStatementResultV2( + args: GetStatementResultV2CommandInput, + options?: __HttpHandlerOptions + ): Promise; + getStatementResultV2( + args: GetStatementResultV2CommandInput, + cb: (err: any, data?: GetStatementResultV2CommandOutput) => void + ): void; + getStatementResultV2( + args: GetStatementResultV2CommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GetStatementResultV2CommandOutput) => void + ): void; + /** * @see {@link ListDatabasesCommand} */ diff --git a/clients/client-redshift-data/src/RedshiftDataClient.ts b/clients/client-redshift-data/src/RedshiftDataClient.ts index 181bb1e3ff74..610faa6811bf 100644 --- a/clients/client-redshift-data/src/RedshiftDataClient.ts +++ b/clients/client-redshift-data/src/RedshiftDataClient.ts @@ -62,6 +62,10 @@ import { DescribeStatementCommandInput, DescribeStatementCommandOutput } from ". import { DescribeTableCommandInput, DescribeTableCommandOutput } from "./commands/DescribeTableCommand"; import { ExecuteStatementCommandInput, ExecuteStatementCommandOutput } from "./commands/ExecuteStatementCommand"; import { GetStatementResultCommandInput, GetStatementResultCommandOutput } from "./commands/GetStatementResultCommand"; +import { + GetStatementResultV2CommandInput, + GetStatementResultV2CommandOutput, +} from "./commands/GetStatementResultV2Command"; import { ListDatabasesCommandInput, ListDatabasesCommandOutput } from "./commands/ListDatabasesCommand"; import { ListSchemasCommandInput, ListSchemasCommandOutput } from "./commands/ListSchemasCommand"; import { ListStatementsCommandInput, ListStatementsCommandOutput } from "./commands/ListStatementsCommand"; @@ -87,6 +91,7 @@ export type ServiceInputTypes = | DescribeTableCommandInput | ExecuteStatementCommandInput | GetStatementResultCommandInput + | GetStatementResultV2CommandInput | ListDatabasesCommandInput | ListSchemasCommandInput | ListStatementsCommandInput @@ -102,6 +107,7 @@ export type ServiceOutputTypes = | DescribeTableCommandOutput | ExecuteStatementCommandOutput | GetStatementResultCommandOutput + | GetStatementResultV2CommandOutput | ListDatabasesCommandOutput | ListSchemasCommandOutput | ListStatementsCommandOutput diff --git a/clients/client-redshift-data/src/commands/BatchExecuteStatementCommand.ts b/clients/client-redshift-data/src/commands/BatchExecuteStatementCommand.ts index 342067d35458..a6d0b7dedcd6 100644 --- a/clients/client-redshift-data/src/commands/BatchExecuteStatementCommand.ts +++ b/clients/client-redshift-data/src/commands/BatchExecuteStatementCommand.ts @@ -85,6 +85,7 @@ export interface BatchExecuteStatementCommandOutput extends BatchExecuteStatemen * ClientToken: "STRING_VALUE", * SessionKeepAliveSeconds: Number("int"), * SessionId: "STRING_VALUE", + * ResultFormat: "STRING_VALUE", * }; * const command = new BatchExecuteStatementCommand(input); * const response = await client.send(command); diff --git a/clients/client-redshift-data/src/commands/DescribeStatementCommand.ts b/clients/client-redshift-data/src/commands/DescribeStatementCommand.ts index 7f9c1cb6d587..385c185074ea 100644 --- a/clients/client-redshift-data/src/commands/DescribeStatementCommand.ts +++ b/clients/client-redshift-data/src/commands/DescribeStatementCommand.ts @@ -85,6 +85,7 @@ export interface DescribeStatementCommandOutput extends DescribeStatementRespons * // ], * // WorkgroupName: "STRING_VALUE", * // SessionId: "STRING_VALUE", + * // ResultFormat: "STRING_VALUE", * // }; * * ``` diff --git a/clients/client-redshift-data/src/commands/ExecuteStatementCommand.ts b/clients/client-redshift-data/src/commands/ExecuteStatementCommand.ts index 8a78fbe4d818..9bc89925ec06 100644 --- a/clients/client-redshift-data/src/commands/ExecuteStatementCommand.ts +++ b/clients/client-redshift-data/src/commands/ExecuteStatementCommand.ts @@ -89,6 +89,7 @@ export interface ExecuteStatementCommandOutput extends ExecuteStatementOutput, _ * ClientToken: "STRING_VALUE", * SessionKeepAliveSeconds: Number("int"), * SessionId: "STRING_VALUE", + * ResultFormat: "STRING_VALUE", * }; * const command = new ExecuteStatementCommand(input); * const response = await client.send(command); diff --git a/clients/client-redshift-data/src/commands/GetStatementResultCommand.ts b/clients/client-redshift-data/src/commands/GetStatementResultCommand.ts index e3b8c0c6b737..311d516f5f3a 100644 --- a/clients/client-redshift-data/src/commands/GetStatementResultCommand.ts +++ b/clients/client-redshift-data/src/commands/GetStatementResultCommand.ts @@ -28,8 +28,10 @@ export interface GetStatementResultCommandInput extends GetStatementResultReques export interface GetStatementResultCommandOutput extends GetStatementResultResponse, __MetadataBearer {} /** - *

Fetches the temporarily cached result of an SQL statement. - * A token is returned to page through the statement results.

+ *

Fetches the temporarily cached result of an SQL statement in JSON format. + * The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as JSON + * , or let the format default to JSON. + * A token is returned to page through the statement results.

*

For more information about the Amazon Redshift Data API and CLI usage examples, see * Using the Amazon Redshift Data API in the * Amazon Redshift Management Guide.

diff --git a/clients/client-redshift-data/src/commands/GetStatementResultV2Command.ts b/clients/client-redshift-data/src/commands/GetStatementResultV2Command.ts new file mode 100644 index 000000000000..efc4d949f282 --- /dev/null +++ b/clients/client-redshift-data/src/commands/GetStatementResultV2Command.ts @@ -0,0 +1,131 @@ +// smithy-typescript generated code +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { commonParams } from "../endpoint/EndpointParameters"; +import { GetStatementResultV2Request, GetStatementResultV2Response } from "../models/models_0"; +import { de_GetStatementResultV2Command, se_GetStatementResultV2Command } from "../protocols/Aws_json1_1"; +import { RedshiftDataClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RedshiftDataClient"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link GetStatementResultV2Command}. + */ +export interface GetStatementResultV2CommandInput extends GetStatementResultV2Request {} +/** + * @public + * + * The output of {@link GetStatementResultV2Command}. + */ +export interface GetStatementResultV2CommandOutput extends GetStatementResultV2Response, __MetadataBearer {} + +/** + *

Fetches the temporarily cached result of an SQL statement in CSV format. + * The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as CSV. + * A token is returned to page through the statement results.

+ *

For more information about the Amazon Redshift Data API and CLI usage examples, see + * Using the Amazon Redshift Data API in the + * Amazon Redshift Management Guide.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RedshiftDataClient, GetStatementResultV2Command } from "@aws-sdk/client-redshift-data"; // ES Modules import + * // const { RedshiftDataClient, GetStatementResultV2Command } = require("@aws-sdk/client-redshift-data"); // CommonJS import + * const client = new RedshiftDataClient(config); + * const input = { // GetStatementResultV2Request + * Id: "STRING_VALUE", // required + * NextToken: "STRING_VALUE", + * }; + * const command = new GetStatementResultV2Command(input); + * const response = await client.send(command); + * // { // GetStatementResultV2Response + * // Records: [ // FormattedSqlRecords // required + * // { // QueryRecords Union: only one key present + * // CSVRecords: "STRING_VALUE", + * // }, + * // ], + * // ColumnMetadata: [ // ColumnMetadataList + * // { // ColumnMetadata + * // isCaseSensitive: true || false, + * // isCurrency: true || false, + * // isSigned: true || false, + * // label: "STRING_VALUE", + * // name: "STRING_VALUE", + * // nullable: Number("int"), + * // precision: Number("int"), + * // scale: Number("int"), + * // schemaName: "STRING_VALUE", + * // tableName: "STRING_VALUE", + * // typeName: "STRING_VALUE", + * // length: Number("int"), + * // columnDefault: "STRING_VALUE", + * // }, + * // ], + * // TotalNumRows: Number("long"), + * // ResultFormat: "STRING_VALUE", + * // NextToken: "STRING_VALUE", + * // }; + * + * ``` + * + * @param GetStatementResultV2CommandInput - {@link GetStatementResultV2CommandInput} + * @returns {@link GetStatementResultV2CommandOutput} + * @see {@link GetStatementResultV2CommandInput} for command's `input` shape. + * @see {@link GetStatementResultV2CommandOutput} for command's `response` shape. + * @see {@link RedshiftDataClientResolvedConfig | config} for RedshiftDataClient's `config` shape. + * + * @throws {@link InternalServerException} (server fault) + *

The Amazon Redshift Data API operation failed due to invalid input.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The Amazon Redshift Data API operation failed due to a missing resource.

+ * + * @throws {@link ValidationException} (client fault) + *

The Amazon Redshift Data API operation failed due to invalid input.

+ * + * @throws {@link RedshiftDataServiceException} + *

Base exception class for all service exceptions from RedshiftData service.

+ * + * @public + */ +export class GetStatementResultV2Command extends $Command + .classBuilder< + GetStatementResultV2CommandInput, + GetStatementResultV2CommandOutput, + RedshiftDataClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: RedshiftDataClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("RedshiftData", "GetStatementResultV2", {}) + .n("RedshiftDataClient", "GetStatementResultV2Command") + .f(void 0, void 0) + .ser(se_GetStatementResultV2Command) + .de(de_GetStatementResultV2Command) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: GetStatementResultV2Request; + output: GetStatementResultV2Response; + }; + sdk: { + input: GetStatementResultV2CommandInput; + output: GetStatementResultV2CommandOutput; + }; + }; +} diff --git a/clients/client-redshift-data/src/commands/ListStatementsCommand.ts b/clients/client-redshift-data/src/commands/ListStatementsCommand.ts index 2598d5610b96..6adca25f9eb1 100644 --- a/clients/client-redshift-data/src/commands/ListStatementsCommand.ts +++ b/clients/client-redshift-data/src/commands/ListStatementsCommand.ts @@ -69,6 +69,7 @@ export interface ListStatementsCommandOutput extends ListStatementsResponse, __M * // ], * // IsBatchStatement: true || false, * // SessionId: "STRING_VALUE", + * // ResultFormat: "STRING_VALUE", * // }, * // ], * // NextToken: "STRING_VALUE", diff --git a/clients/client-redshift-data/src/commands/index.ts b/clients/client-redshift-data/src/commands/index.ts index 32522b0e5009..7847228d442d 100644 --- a/clients/client-redshift-data/src/commands/index.ts +++ b/clients/client-redshift-data/src/commands/index.ts @@ -5,6 +5,7 @@ export * from "./DescribeStatementCommand"; export * from "./DescribeTableCommand"; export * from "./ExecuteStatementCommand"; export * from "./GetStatementResultCommand"; +export * from "./GetStatementResultV2Command"; export * from "./ListDatabasesCommand"; export * from "./ListSchemasCommand"; export * from "./ListStatementsCommand"; diff --git a/clients/client-redshift-data/src/models/models_0.ts b/clients/client-redshift-data/src/models/models_0.ts index 1aaa833923b9..15960714df5d 100644 --- a/clients/client-redshift-data/src/models/models_0.ts +++ b/clients/client-redshift-data/src/models/models_0.ts @@ -75,6 +75,20 @@ export class BatchExecuteStatementException extends __BaseException { } } +/** + * @public + * @enum + */ +export const ResultFormatString = { + CSV: "CSV", + JSON: "JSON", +} as const; + +/** + * @public + */ +export type ResultFormatString = (typeof ResultFormatString)[keyof typeof ResultFormatString]; + /** * @public */ @@ -148,6 +162,12 @@ export interface BatchExecuteStatementInput { * @public */ SessionId?: string; + + /** + *

The data format of the result of the SQL statement. If no format is specified, the default is JSON.

+ * @public + */ + ResultFormat?: ResultFormatString; } /** @@ -725,6 +745,12 @@ export interface DescribeStatementResponse { * @public */ SessionId?: string; + + /** + *

The data format of the result of the SQL statement.

+ * @public + */ + ResultFormat?: ResultFormatString; } /** @@ -948,6 +974,12 @@ export interface ExecuteStatementInput { * @public */ SessionId?: string; + + /** + *

The data format of the result of the SQL statement. If no format is specified, the default is JSON.

+ * @public + */ + ResultFormat?: ResultFormatString; } /** @@ -1144,6 +1176,44 @@ export namespace Field { }; } +/** + *

The results of the SQL statement.

+ * @public + */ +export type QueryRecords = QueryRecords.CSVRecordsMember | QueryRecords.$UnknownMember; + +/** + * @public + */ +export namespace QueryRecords { + /** + *

The results of the SQL statement in CSV format.

+ * @public + */ + export interface CSVRecordsMember { + CSVRecords: string; + $unknown?: never; + } + + /** + * @public + */ + export interface $UnknownMember { + CSVRecords?: never; + $unknown: [string, any]; + } + + export interface Visitor { + CSVRecords: (value: string) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: QueryRecords, visitor: Visitor): T => { + if (value.CSVRecords !== undefined) return visitor.CSVRecords(value.CSVRecords); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; +} + /** * @public */ @@ -1169,7 +1239,7 @@ export interface GetStatementResultRequest { */ export interface GetStatementResultResponse { /** - *

The results of the SQL statement.

+ *

The results of the SQL statement in JSON format.

* @public */ Records: Field[][] | undefined; @@ -1194,6 +1264,62 @@ export interface GetStatementResultResponse { NextToken?: string; } +/** + * @public + */ +export interface GetStatementResultV2Request { + /** + *

The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. + * A suffix indicates then number of the SQL statement. + * For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. + * This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.

+ * @public + */ + Id: string | undefined; + + /** + *

A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

+ * @public + */ + NextToken?: string; +} + +/** + * @public + */ +export interface GetStatementResultV2Response { + /** + *

The results of the SQL statement in CSV format.

+ * @public + */ + Records: QueryRecords[] | undefined; + + /** + *

The properties (metadata) of a column.

+ * @public + */ + ColumnMetadata?: ColumnMetadata[]; + + /** + *

The total number of rows in the result set returned from a query. + * You can use this number to estimate the number of calls to the GetStatementResultV2 operation needed to page through the results.

+ * @public + */ + TotalNumRows?: number; + + /** + *

The data format of the result of the SQL statement.

+ * @public + */ + ResultFormat?: ResultFormatString; + + /** + *

A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

+ * @public + */ + NextToken?: string; +} + /** * @public */ @@ -1474,6 +1600,12 @@ export interface StatementData { * @public */ SessionId?: string; + + /** + *

The data format of the result of the SQL statement.

+ * @public + */ + ResultFormat?: ResultFormatString; } /** diff --git a/clients/client-redshift-data/src/pagination/GetStatementResultV2Paginator.ts b/clients/client-redshift-data/src/pagination/GetStatementResultV2Paginator.ts new file mode 100644 index 000000000000..b9359ab79fd3 --- /dev/null +++ b/clients/client-redshift-data/src/pagination/GetStatementResultV2Paginator.ts @@ -0,0 +1,24 @@ +// smithy-typescript generated code +import { createPaginator } from "@smithy/core"; +import { Paginator } from "@smithy/types"; + +import { + GetStatementResultV2Command, + GetStatementResultV2CommandInput, + GetStatementResultV2CommandOutput, +} from "../commands/GetStatementResultV2Command"; +import { RedshiftDataClient } from "../RedshiftDataClient"; +import { RedshiftDataPaginationConfiguration } from "./Interfaces"; + +/** + * @public + */ +export const paginateGetStatementResultV2: ( + config: RedshiftDataPaginationConfiguration, + input: GetStatementResultV2CommandInput, + ...rest: any[] +) => Paginator = createPaginator< + RedshiftDataPaginationConfiguration, + GetStatementResultV2CommandInput, + GetStatementResultV2CommandOutput +>(RedshiftDataClient, GetStatementResultV2Command, "NextToken", "NextToken", ""); diff --git a/clients/client-redshift-data/src/pagination/index.ts b/clients/client-redshift-data/src/pagination/index.ts index 7ae88a638017..060ced460b1e 100644 --- a/clients/client-redshift-data/src/pagination/index.ts +++ b/clients/client-redshift-data/src/pagination/index.ts @@ -1,6 +1,8 @@ export * from "./DescribeTablePaginator"; export * from "./GetStatementResultPaginator"; + +export * from "./GetStatementResultV2Paginator"; // smithy-typescript generated code export * from "./Interfaces"; export * from "./ListDatabasesPaginator"; diff --git a/clients/client-redshift-data/src/protocols/Aws_json1_1.ts b/clients/client-redshift-data/src/protocols/Aws_json1_1.ts index 39790608efe7..d1958680c6d7 100644 --- a/clients/client-redshift-data/src/protocols/Aws_json1_1.ts +++ b/clients/client-redshift-data/src/protocols/Aws_json1_1.ts @@ -37,6 +37,10 @@ import { DescribeStatementCommandInput, DescribeStatementCommandOutput } from ". import { DescribeTableCommandInput, DescribeTableCommandOutput } from "../commands/DescribeTableCommand"; import { ExecuteStatementCommandInput, ExecuteStatementCommandOutput } from "../commands/ExecuteStatementCommand"; import { GetStatementResultCommandInput, GetStatementResultCommandOutput } from "../commands/GetStatementResultCommand"; +import { + GetStatementResultV2CommandInput, + GetStatementResultV2CommandOutput, +} from "../commands/GetStatementResultV2Command"; import { ListDatabasesCommandInput, ListDatabasesCommandOutput } from "../commands/ListDatabasesCommand"; import { ListSchemasCommandInput, ListSchemasCommandOutput } from "../commands/ListSchemasCommand"; import { ListStatementsCommandInput, ListStatementsCommandOutput } from "../commands/ListStatementsCommand"; @@ -58,6 +62,7 @@ import { Field, GetStatementResultRequest, GetStatementResultResponse, + GetStatementResultV2Request, InternalServerException, ListDatabasesRequest, ListSchemasRequest, @@ -151,6 +156,19 @@ export const se_GetStatementResultCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +/** + * serializeAws_json1_1GetStatementResultV2Command + */ +export const se_GetStatementResultV2Command = async ( + input: GetStatementResultV2CommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = sharedHeaders("GetStatementResultV2"); + let body: any; + body = JSON.stringify(_json(input)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + /** * serializeAws_json1_1ListDatabasesCommand */ @@ -323,6 +341,26 @@ export const de_GetStatementResultCommand = async ( return response; }; +/** + * deserializeAws_json1_1GetStatementResultV2Command + */ +export const de_GetStatementResultV2Command = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = _json(data); + const response: GetStatementResultV2CommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return response; +}; + /** * deserializeAws_json1_1ListDatabasesCommand */ @@ -600,6 +638,7 @@ const se_BatchExecuteStatementInput = (input: BatchExecuteStatementInput, contex ClusterIdentifier: [], Database: [], DbUser: [], + ResultFormat: [], SecretArn: [], SessionId: [], SessionKeepAliveSeconds: [], @@ -626,6 +665,7 @@ const se_ExecuteStatementInput = (input: ExecuteStatementInput, context: __Serde Database: [], DbUser: [], Parameters: _json, + ResultFormat: [], SecretArn: [], SessionId: [], SessionKeepAliveSeconds: [], @@ -638,6 +678,8 @@ const se_ExecuteStatementInput = (input: ExecuteStatementInput, context: __Serde // se_GetStatementResultRequest omitted. +// se_GetStatementResultV2Request omitted. + // se_ListDatabasesRequest omitted. // se_ListSchemasRequest omitted. @@ -706,6 +748,7 @@ const de_DescribeStatementResponse = (output: any, context: __SerdeContext): Des QueryString: __expectString, RedshiftPid: __expectLong, RedshiftQueryId: __expectLong, + ResultFormat: __expectString, ResultRows: __expectLong, ResultSize: __expectLong, SecretArn: __expectString, @@ -777,6 +820,8 @@ const de_FieldList = (output: any, context: __SerdeContext): Field[] => { return retVal; }; +// de_FormattedSqlRecords omitted. + /** * deserializeAws_json1_1GetStatementResultResponse */ @@ -789,6 +834,8 @@ const de_GetStatementResultResponse = (output: any, context: __SerdeContext): Ge }) as any; }; +// de_GetStatementResultV2Response omitted. + // de_InternalServerException omitted. // de_ListDatabasesResponse omitted. @@ -807,6 +854,8 @@ const de_ListStatementsResponse = (output: any, context: __SerdeContext): ListSt // de_ListTablesResponse omitted. +// de_QueryRecords omitted. + // de_QueryTimeoutException omitted. // de_ResourceNotFoundException omitted. @@ -840,6 +889,7 @@ const de_StatementData = (output: any, context: __SerdeContext): StatementData = QueryParameters: _json, QueryString: __expectString, QueryStrings: _json, + ResultFormat: __expectString, SecretArn: __expectString, SessionId: __expectString, StatementName: __expectString, diff --git a/codegen/sdk-codegen/aws-models/redshift-data.json b/codegen/sdk-codegen/aws-models/redshift-data.json index 69ac3e7cf3c0..e2125967f823 100644 --- a/codegen/sdk-codegen/aws-models/redshift-data.json +++ b/codegen/sdk-codegen/aws-models/redshift-data.json @@ -149,6 +149,12 @@ "traits": { "smithy.api#documentation": "

The session identifier of the query.

" } + }, + "ResultFormat": { + "target": "com.amazonaws.redshiftdata#ResultFormatString", + "traits": { + "smithy.api#documentation": "

The data format of the result of the SQL statement. If no format is specified, the default is JSON.

" + } } }, "traits": { @@ -299,8 +305,7 @@ "smithy.api#length": { "min": 1, "max": 63 - }, - "smithy.api#pattern": "^[a-z]([a-z0-9]|-[a-z0-9])*$" + } } }, "com.amazonaws.redshiftdata#ColumnList": { @@ -603,6 +608,12 @@ "traits": { "smithy.api#documentation": "

The session identifier of the query.

" } + }, + "ResultFormat": { + "target": "com.amazonaws.redshiftdata#ResultFormatString", + "traits": { + "smithy.api#documentation": "

The data format of the result of the SQL statement.

" + } } }, "traits": { @@ -867,6 +878,12 @@ "traits": { "smithy.api#documentation": "

The session identifier of the query.

" } + }, + "ResultFormat": { + "target": "com.amazonaws.redshiftdata#ResultFormatString", + "traits": { + "smithy.api#documentation": "

The data format of the result of the SQL statement. If no format is specified, the default is JSON.

" + } } }, "traits": { @@ -985,6 +1002,12 @@ "target": "com.amazonaws.redshiftdata#Field" } }, + "com.amazonaws.redshiftdata#FormattedSqlRecords": { + "type": "list", + "member": { + "target": "com.amazonaws.redshiftdata#QueryRecords" + } + }, "com.amazonaws.redshiftdata#GetStatementResult": { "type": "operation", "input": { @@ -1005,7 +1028,7 @@ } ], "traits": { - "smithy.api#documentation": "

Fetches the temporarily cached result of an SQL statement. \n A token is returned to page through the statement results.

\n

For more information about the Amazon Redshift Data API and CLI usage examples, see \n Using the Amazon Redshift Data API in the \n Amazon Redshift Management Guide.

", + "smithy.api#documentation": "

Fetches the temporarily cached result of an SQL statement in JSON format. \n The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as JSON\n , or let the format default to JSON.\n A token is returned to page through the statement results.

\n

For more information about the Amazon Redshift Data API and CLI usage examples, see \n Using the Amazon Redshift Data API in the \n Amazon Redshift Management Guide.

", "smithy.api#paginated": { "inputToken": "NextToken", "outputToken": "NextToken", @@ -1041,7 +1064,7 @@ "Records": { "target": "com.amazonaws.redshiftdata#SqlRecords", "traits": { - "smithy.api#documentation": "

The results of the SQL statement.

", + "smithy.api#documentation": "

The results of the SQL statement in JSON format.

", "smithy.api#required": {} } }, @@ -1069,6 +1092,96 @@ "smithy.api#output": {} } }, + "com.amazonaws.redshiftdata#GetStatementResultV2": { + "type": "operation", + "input": { + "target": "com.amazonaws.redshiftdata#GetStatementResultV2Request" + }, + "output": { + "target": "com.amazonaws.redshiftdata#GetStatementResultV2Response" + }, + "errors": [ + { + "target": "com.amazonaws.redshiftdata#InternalServerException" + }, + { + "target": "com.amazonaws.redshiftdata#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.redshiftdata#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Fetches the temporarily cached result of an SQL statement in CSV format. \n The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as CSV.\n A token is returned to page through the statement results.

\n

For more information about the Amazon Redshift Data API and CLI usage examples, see \n Using the Amazon Redshift Data API in the \n Amazon Redshift Management Guide.

", + "smithy.api#paginated": { + "inputToken": "NextToken", + "outputToken": "NextToken", + "items": "Records" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.redshiftdata#GetStatementResultV2Request": { + "type": "structure", + "members": { + "Id": { + "target": "com.amazonaws.redshiftdata#UUID", + "traits": { + "smithy.api#documentation": "

The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. \n A suffix indicates then number of the SQL statement.\n For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query.\n This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.

", + "smithy.api#required": {} + } + }, + "NextToken": { + "target": "com.amazonaws.redshiftdata#String", + "traits": { + "smithy.api#documentation": "

A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.redshiftdata#GetStatementResultV2Response": { + "type": "structure", + "members": { + "Records": { + "target": "com.amazonaws.redshiftdata#FormattedSqlRecords", + "traits": { + "smithy.api#documentation": "

The results of the SQL statement in CSV format.

", + "smithy.api#required": {} + } + }, + "ColumnMetadata": { + "target": "com.amazonaws.redshiftdata#ColumnMetadataList", + "traits": { + "smithy.api#documentation": "

The properties (metadata) of a column.

" + } + }, + "TotalNumRows": { + "target": "com.amazonaws.redshiftdata#Long", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The total number of rows in the result set returned from a query. \n You can use this number to estimate the number of calls to the GetStatementResultV2 operation needed to page through the results.

" + } + }, + "ResultFormat": { + "target": "com.amazonaws.redshiftdata#ResultFormatString", + "traits": { + "smithy.api#documentation": "

The data format of the result of the SQL statement.

" + } + }, + "NextToken": { + "target": "com.amazonaws.redshiftdata#String", + "traits": { + "smithy.api#documentation": "

A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.redshiftdata#Integer": { "type": "integer", "traits": { @@ -1564,6 +1677,20 @@ } } }, + "com.amazonaws.redshiftdata#QueryRecords": { + "type": "union", + "members": { + "CSVRecords": { + "target": "com.amazonaws.redshiftdata#String", + "traits": { + "smithy.api#documentation": "

The results of the SQL statement in CSV format.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The results of the SQL statement.

" + } + }, "com.amazonaws.redshiftdata#QueryTimeoutException": { "type": "structure", "members": { @@ -1599,6 +1726,9 @@ { "target": "com.amazonaws.redshiftdata#GetStatementResult" }, + { + "target": "com.amazonaws.redshiftdata#GetStatementResultV2" + }, { "target": "com.amazonaws.redshiftdata#ListDatabases" }, @@ -2278,6 +2408,21 @@ "smithy.api#httpError": 404 } }, + "com.amazonaws.redshiftdata#ResultFormatString": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "name": "JSON", + "value": "JSON" + }, + { + "name": "CSV", + "value": "CSV" + } + ] + } + }, "com.amazonaws.redshiftdata#SchemaList": { "type": "list", "member": { @@ -2416,6 +2561,12 @@ "traits": { "smithy.api#documentation": "

The session identifier of the query.

" } + }, + "ResultFormat": { + "target": "com.amazonaws.redshiftdata#ResultFormatString", + "traits": { + "smithy.api#documentation": "

The data format of the result of the SQL statement.

" + } } }, "traits": {