amazon-web-services - 使用 AWS 爬虫创建 Athena 表
问题描述
我正在尝试使用 AWS Glue Crawler 为存储在 S3 存储桶中的文件创建元数据表。下面是一些 s3 结构看起来像 -
test_bucket/
└── test_folder1
└── test_folder2
└── output
├── file_1
│ └── file_1.csv
├── file_2
│ └── file_2.csv
└── intermediate_files
├── file_11
│ └── file_11.csv
├── file_12
│ └── file_12.csv
├── file_21
│ └── file_21.csv
└── file_22
└── file_22.csv
设置配置确实为“输出”目录中的每个文件创建单独的 Athena 表,即,对于 file_1.csv 和 file_2.csv,但对于“intermediate_files”目录,会创建一个分区表,该文件夹中的文件是分区列。
实际的雅典娜表
file_1
file_2
intermediate_files (partitioned)
但我也想为每个中间文件创建单独的表。
预期的雅典娜表
file_1
file_11
file_12
file_2
file_21
file_22
AWS 爬虫配置如下 -
Name some_name
Description
Create a single schema for each S3 path false
Table level
Security configuration
Tags -
State Ready
Schedule
Last updated Wed Oct 13 17:32:33 GMT+530 2021
Date created Wed Oct 13 15:39:12 GMT+530 2021
Database some_db
Service role some_role
Selected classifiers csv_classifier
Data store S3
Include path s3://test_bucket/test_folder1/test_folder2/
Connection
Exclude patterns
Configuration options
Schema updates in the data store Update the table definition in the data catalog.
Inherit schema from table Update all new and existing partitions with metadata from the table.
Object deletion in the data store Mark the table as deprecated in the data catalog.
而且,创建的分区表也缺少一些中间文件中的几列。
我对 AWS 爬虫不太熟悉,所以请让我知道我可以设置的爬虫配置来实现这两种场景中的任何一种 -
- 为 test_customer 文件夹中的每个文件获取单独的 athena 表
- 或者,获取 middle_files 分区表中缺少的列
我真的很感激任何形式的帮助。谢谢!
解决方案
您获得单个分区表的原因intermediate_files/
是该目录中的文件具有相同的架构。我假设其他文件之间的差异足以让爬虫确定它们需要是不同的表。
intermediate_files/
您可以通过将每个目录添加为爬虫的单独包含路径来影响爬虫如何做出此决定,这将告诉它将它们放入不同的表中。
我推荐阅读爬虫如何确定何时创建分区?在 Glue 文档中,它有一个如何解决类似情况的具体示例。
推荐阅读
- wordpress - 如何从 WordPress 仪表板启用外观选项?
- javascript - Highcharts Activity Gauge 中的数据标签
- javascript - 我的网站表单中的自动完成在桌面浏览器和 IOS 浏览器中运行良好,但在 android 浏览器中无法运行......不知道为什么?
- python - Jupyter 笔记本中未找到模块错误
- python - 在 Python 中执行函数链
- flutter - 错误:没有为类“对象”定义吸气剂“长度”?
- google-api - Google Homegraph API:无法发送状态:reportState 中的“ERROR”
- c# - Rabbitmq Channel.Dispose vs channel = null
- javascript - 创建 React 应用程序失败。我用 npm init react-app my-app
- java - 滚动回收站视图时工具栏不隐藏