我使用无服务器文件 + CloudFormation 在 AWS Athena 服务上创建表。
我的无服务器.yml:
...
CardBulkWorkgroup:
Type: AWS::Athena::WorkGroup
Properties:
Name: ${opt:stage}-${opt:client}-CardBulk
WorkGroupConfiguration:
ResultConfiguration:
OutputLocation: s3://${lower:${opt:stage}}-${lower:${opt:client}}-card-bulk-athena-result
CardBulkDatabase:
Type: AWS::Glue::Database
Properties:
CatalogId: !Ref AWS::AccountId
DatabaseInput:
Name: ${lower:${opt:stage}}_${lower:${opt:client}}_bulkcard
CardBulkTable:
Type: AWS::Glue::Table
Properties:
CatalogId: !Ref AWS::AccountId
DatabaseName: !Ref CardBulkDatabase
TableInput:
Name: card
StorageDescriptor:
Columns:
- Name: cardId
Type: int
- Name: metadata
Type: struct<orderId:string, convertVirtualToPhysicalErrors:string>
- Name: orderId
Type: string
- Name: errors
Type: string
Location: s3://${lower:${opt:stage}}_${lower:${opt:client}}-files/cards
InputFormat: org.apache.hadoop.mapred.TextInputFormat
OutputFormat: org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat
SerdeInfo:
SerializationLibrary: org.openx.data.jsonserde.JsonSerDe
Parameters:
"serialization.format": "1"
CardBulkAthenaBucketResult:
Type: AWS::S3::Bucket …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation amazon-athena serverless