AWS::Athena::NamedQuery
The
AWS::Athena::NamedQuery resource creates an Amazon Athena query. For more information, see
CreateNamedQuery in the
Amazon Athena Documentation.
Topics
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Athena::NamedQuery", "Properties" : { "Description" :String, "QueryString" :String, "Database" :String, "Name" :String} }
YAML
Type: AWS::Athena::NamedQuery Properties: Description:StringQueryString:StringDatabase:StringName:String
Properties
For constraints, see NamedQuery in the Amazon Athena API Reference.
Description-
A brief description of the query.
Required: No
Type: String
Update requires: No interruption
QueryString-
The SQL query statements that comprise the query.
Required: Yes
Type: String
Update requires: Replacement
Database-
The database to which the query belongs.
Required: Yes
Type: String
Update requires: No interruption
Name-
The plain-language name of the query.
Required: No
Type: String
Update requires: Replacement
Return Values
Ref
When the logical ID of this resource is provided to the Ref intrinsic
function, Ref returns the resource name.
For more information about using the
Ref function, see
Ref.
Examples
The following example creates a named query.
JSON
{ "Resources": { "AthenaNamedQuery": { "Type": "AWS::Athena::NamedQuery", "Properties": { "Database": "swfnetadata", "Description": "A query that selects all aggregated data", "Name": "MostExpensiveWorkflow", "QueryString": "SELECT workflowname, AVG(activitytaskstarted) AS AverageWorkflow FROM swfmetadata WHERE year='17' AND GROUP BY workflowname ORDER BY AverageWorkflow DESC LIMIT 10" } } } }
YAML
Resources: AthenaNamedQuery: Type: AWS::Athena::NamedQuery Properties: Database: "swfnetadata" Description: "A query that selects all aggregated data" Name: "MostExpensiveWorkflow" QueryString: > SELECT workflowname, AVG(activitytaskstarted) AS AverageWorkflow FROM swfmetadata WHERE year='17' AND GROUP BY workflowname ORDER BY AverageWorkflow DESC LIMIT 10
