Amazon cloudformation 什么是「;雅典娜数据库;在AWS::Athena::NamedQuery模板中?

Amazon cloudformation 什么是「;雅典娜数据库;在AWS::Athena::NamedQuery模板中?,amazon-cloudformation,amazon-athena,Amazon Cloudformation,Amazon Athena,在forAWS::Athena::NamedQuery中,我们有一个可爱的YAML Resources: AthenaNamedQuery: Type: AWS::Athena::NamedQuery Properties: Database: "swfnetadata" Description: "A query that selects all aggregated data" Name: "MostExpensiveWorkflow"

在for
AWS::Athena::NamedQuery
中,我们有一个可爱的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

但是什么是
数据库:“swfnetadata”
?我在哪里/如何定义它?

AWS Athena表只能存在于数据库中

从文档中:

Athena使用ApacheHive定义表和创建数据库 本质上是表的逻辑名称空间。当您创建 在Athena中,您只需描述模式和 表数据位于AmazonS3中,用于读取时间查询

因此,在您的情况下,您必须说明在其中创建表的数据库


创建Athena数据库的Cloudformation片段,这是一个Glue数据库

Parameters:
  DatabaseName:
    Type: String
    Default: dev_db
Resources:
 # Create an AWS Glue database
  MyDevAthenaDatabase:
    Type: AWS::Glue::Database
    Properties:
      # The database is created in the Data Catalog for your account
      CatalogId: !Ref AWS::AccountId
      DatabaseInput:
        # The name of the database is defined in the Parameters section above
        Name: !Ref DatabaseName
        Description: Database to hold dev tables
# Create tables
  MyGlueTable1:
    Type: AWS::Glue::Table
    DependsOn: MyDevAthenaDatabase

如何在Cloudformation中创建Apache Hive数据库?如果您不需要数据库,那么使用
default
就可以了