Skip to main content

named_queries

Creates, updates, deletes or gets a named_query resource or lists named_queries in a region

Overview

Namenamed_queries
TypeResource
DescriptionResource schema for AWS::Athena::NamedQuery
Idaws.athena.named_queries

Fields

NameDatatypeDescription
namestringThe query name.
databasestringThe database to which the query belongs.
descriptionstringThe query description.
query_stringstringThe contents of the query with all query statements.
work_groupstringThe name of the workgroup that contains the named query.
named_query_idstringThe unique ID of the query.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTDatabase, QueryString, region
delete_resourceDELETEdata__Identifier, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all named_queries in a region.

SELECT
region,
name,
database,
description,
query_string,
work_group,
named_query_id
FROM aws.athena.named_queries
WHERE region = 'us-east-1';

Gets all properties from an individual named_query.

SELECT
region,
name,
database,
description,
query_string,
work_group,
named_query_id
FROM aws.athena.named_queries
WHERE region = 'us-east-1' AND data__Identifier = '<NamedQueryId>';

INSERT example

Use the following StackQL query and manifest file to create a new named_query resource, using stack-deploy.

/*+ create */
INSERT INTO aws.athena.named_queries (
Database,
QueryString,
region
)
SELECT
'{{ Database }}',
'{{ QueryString }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.athena.named_queries
WHERE data__Identifier = '<NamedQueryId>'
AND region = 'us-east-1';

Permissions

To operate on the named_queries resource, the following permissions are required:

Create

athena:CreateNamedQuery

Read

athena:GetNamedQuery

List

athena:ListNamedQueries

Delete

athena:DeleteNamedQuery