Menu
Amazon Athena
Amazon Athena Documentation (API Version 2017-05-18)

CreateNamedQuery

Creates a named query.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

Request Syntax

Copy
{ "ClientRequestToken": "string", "Database": "string", "Description": "string", "Name": "string", "QueryString": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

ClientRequestToken

A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another CreateNamedQuery request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the QueryString, an error is returned.

Important

This token is listed as not required because AWS SDKs (for example the AWS SDK for Java) auto-generate the token for users. If you are not using the AWS SDK or the AWS CLI, you must provide this token or the action will fail.

Type: String

Length Constraints: Minimum length of 32. Maximum length of 128.

Required: No

Database

The database to which the query belongs.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 32.

Required: Yes

Description

A brief explanation of the query.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

Name

The plain language name for the query.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Required: Yes

QueryString

The text of the query itself. In other words, all query statements.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 262144.

Required: Yes

Response Syntax

Copy
{ "NamedQueryId": "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.

NamedQueryId

The unique ID of the query.

Type: String

Errors

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

InternalServerException

Indicates a platform issue, which may be due to a transient condition or outage.

HTTP Status Code: 500

InvalidRequestException

Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.

HTTP Status Code: 400

See Also

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