Skip to main content

prepared_statements

Creates, updates, deletes, gets or lists a prepared_statements resource.

Overview

Nameprepared_statements
TypeResource
Idaws.athena.prepared_statements

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
prepared_statementsarrayThe list of prepared statements returned.
unprocessed_prepared_statement_namesarrayA list of one or more prepared statements that were requested but could not be returned.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
batch_get_prepared_statementselectregionReturns 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_statementselectregionRetrieves the prepared statement with the specified name from the specified workgroup.
list_prepared_statementsselectregionLists the prepared statements in the specified workgroup.
create_prepared_statementinsertregion, StatementName, WorkGroup, QueryStatementCreates a prepared statement for use with SQL queries in Athena.
update_prepared_statementupdateregion, StatementName, WorkGroup, QueryStatementUpdates a prepared statement.
delete_prepared_statementdeleteregionDeletes 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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

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
;

INSERT examples

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 }}'
;

UPDATE examples

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

Deletes the prepared statement with the specified name from the specified workgroup.

DELETE FROM aws.athena.prepared_statements
WHERE region = '{{ region }}' --required
;