CreateNamedQuery - Amazon Athena

CreateNamedQuery

Creates a named query in the specified workgroup. Requires that you have access to the workgroup.

Request Syntax

{ "ClientRequestToken": "string", "Database": "string", "Description": "string", "Name": "string", "QueryString": "string", "WorkGroup": "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 255.

Required: Yes

Description

The query description.

Type: String

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

Required: No

Name

The query name.

Type: String

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

Required: Yes

QueryString

The contents of the query with all query statements.

Type: String

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

Required: Yes

WorkGroup

The name of the workgroup in which the named query is being created.

Type: String

Pattern: [a-zA-Z0-9._-]{1,128}

Required: No

Response Syntax

{ "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

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

Pattern: \S+

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: