prepared_statements
Creates, updates, deletes, gets or lists a prepared_statements resource.
Overview
| Name | prepared_statements |
| Type | Resource |
| Id | aws.athena.prepared_statements |
Fields
The following fields are returned by SELECT queries:
- batch_get_prepared_statement
- get_prepared_statement
- list_prepared_statements
| Name | Datatype | Description |
|---|---|---|
prepared_statements | array | The list of prepared statements returned. |
unprocessed_prepared_statement_names | array | A list of one or more prepared statements that were requested but could not be returned. |
| Name | Datatype | Description |
|---|---|---|
description | string | The description of the prepared statement. |
last_modified_time | string (date-time) | The last modified time of the prepared statement. |
query_statement | string | The query string for the prepared statement. |
statement_name | string | The name of the prepared statement. (pattern: <code>[a-zA-Z_][a-zA-Z0-9_@:]{1,256}</code>) |
work_group_name | string | The name of the workgroup to which the prepared statement belongs. (pattern: <code>[a-zA-Z0-9._-]{1,128}</code>) |
| Name | Datatype | Description |
|---|---|---|
next_token | string | A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call. |
prepared_statements | array | The list of prepared statements for the workgroup. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
batch_get_prepared_statement | select | region | Returns the details of a single prepared statement or a list of up to 256 prepared statements for the array of prepared statement names that you provide. Requires you to have access to the workgroup to which the prepared statements belong. If a prepared statement cannot be retrieved for the name specified, the statement is listed in UnprocessedPreparedStatementNames. | |
get_prepared_statement | select | region | Retrieves the prepared statement with the specified name from the specified workgroup. | |
list_prepared_statements | select | region | Lists the prepared statements in the specified workgroup. | |
create_prepared_statement | insert | region, StatementName, WorkGroup, QueryStatement | Creates a prepared statement for use with SQL queries in Athena. | |
update_prepared_statement | update | region, StatementName, WorkGroup, QueryStatement | Updates a prepared statement. | |
delete_prepared_statement | delete | region | Deletes the prepared statement with the specified name from the specified workgroup. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- batch_get_prepared_statement
- get_prepared_statement
- list_prepared_statements
Returns the details of a single prepared statement or a list of up to 256 prepared statements for the array of prepared statement names that you provide. Requires you to have access to the workgroup to which the prepared statements belong. If a prepared statement cannot be retrieved for the name specified, the statement is listed in UnprocessedPreparedStatementNames.
SELECT
prepared_statements,
unprocessed_prepared_statement_names
FROM aws.athena.prepared_statements
WHERE region = '{{ region }}' -- required
;
Retrieves the prepared statement with the specified name from the specified workgroup.
SELECT
description,
last_modified_time,
query_statement,
statement_name,
work_group_name
FROM aws.athena.prepared_statements
WHERE region = '{{ region }}' -- required
;
Lists the prepared statements in the specified workgroup.
SELECT
next_token,
prepared_statements
FROM aws.athena.prepared_statements
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_prepared_statement
- Manifest
Creates a prepared statement for use with SQL queries in Athena.
INSERT INTO aws.athena.prepared_statements (
StatementName,
WorkGroup,
QueryStatement,
Description,
region
)
SELECT
'{{ StatementName }}' /* required */,
'{{ WorkGroup }}' /* required */,
'{{ QueryStatement }}' /* required */,
'{{ Description }}',
'{{ region }}'
;
# Description fields are for documentation purposes
- name: prepared_statements
props:
- name: region
value: "{{ region }}"
description: Required parameter for the prepared_statements resource.
- name: StatementName
value: "{{ StatementName }}"
description: |
The name of the prepared statement.
- name: WorkGroup
value: "{{ WorkGroup }}"
description: |
The name of the workgroup to which the prepared statement belongs.
- name: QueryStatement
value: "{{ QueryStatement }}"
description: |
The query string for the prepared statement.
- name: Description
value: "{{ Description }}"
description: |
The description of the prepared statement.
UPDATE examples
- update_prepared_statement
Updates a prepared statement.
UPDATE aws.athena.prepared_statements
SET
StatementName = '{{ StatementName }}',
WorkGroup = '{{ WorkGroup }}',
QueryStatement = '{{ QueryStatement }}',
Description = '{{ Description }}'
WHERE
region = '{{ region }}' --required
AND StatementName = '{{ StatementName }}' --required
AND WorkGroup = '{{ WorkGroup }}' --required
AND QueryStatement = '{{ QueryStatement }}' --required;
DELETE examples
- delete_prepared_statement
Deletes the prepared statement with the specified name from the specified workgroup.
DELETE FROM aws.athena.prepared_statements
WHERE region = '{{ region }}' --required
;