GenerateQuery - Amazon Bedrock

GenerateQuery

Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.

Request Syntax

POST /generateQuery HTTP/1.1 Content-type: application/json { "queryGenerationInput": { "text": "string", "type": "string" }, "transformationConfiguration": { "mode": "string", "textToSqlConfiguration": { "knowledgeBaseConfiguration": { "knowledgeBaseArn": "string" }, "type": "string" } } }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

queryGenerationInput

Specifies information about a natural language query to transform into SQL.

Type: QueryGenerationInput object

Required: Yes

transformationConfiguration

Specifies configurations for transforming the natural language query into SQL.

Type: TransformationConfiguration object

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "queries": [ { "sql": "string", "type": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

queries

A list of objects, each of which defines a generated query that can correspond to the natural language queries.

Type: Array of GeneratedQuery objects

Array Members: Minimum number of 0 items.

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

The request is denied because of missing access permissions. Check your permissions and retry your request.

HTTP Status Code: 403

BadGatewayException

There was an issue with a dependency due to a server issue. Retry your request.

HTTP Status Code: 502

ConflictException

There was a conflict performing an operation. Resolve the conflict and retry your request.

HTTP Status Code: 409

DependencyFailedException

There was an issue with a dependency. Check the resource configurations and retry the request.

HTTP Status Code: 424

InternalServerException

An internal server error occurred. Retry your request.

HTTP Status Code: 500

ResourceNotFoundException

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

HTTP Status Code: 404

ServiceQuotaExceededException

The number of requests exceeds the service quota. Resubmit your request later.

HTTP Status Code: 400

ThrottlingException

The number of requests exceeds the limit. Resubmit your request later.

HTTP Status Code: 429

ValidationException

Input validation failed. Check your request parameters and retry the request.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: