我在S3中有一个文件夹结构,看起来像这样。
root/
├── parter-1/
| ├── config/
| │ ├── config.json
| │ └── feature.json
| ├── customer-1
| | ├── config/
| | │ ├── config.json
| | │ └── feature.json
| | └── data/
| | ├── model-1/
| | │ ├── input/
| | | | ├── current/
| | | | | ├── tbl1.csv
| | | | | └── tbl2.csv
| | | | └── archive/
| | | | | ├── aod=20211012/
| | | | | ├── tbl1.csv
| | | | └── tbl2.csv
| | | | └── aod=20211210/
| | | | ├── tbl1.csv
| | | | └── tbl2.csv
| | │ └── output/
| | | └──(Same as input)
| | ├── model-2/
| | │ └── (Same as model-1)
| | └── input.zip
| ├── customer-2
| . └── (Same as customer-1)
| .
| |
. └── customer-n
. └── (Same as customer-1)
└── partner-n
└── (Same as partner-1) 现在,我需要在AWS中生成雅典娜表(用于tb1、tbl2)等等。具有sanme tbl1.csv的所有文件都具有相同的模式(列),对于tbl2等文件也是如此。我需要完全忽略config文件夹、zip文件和目录中存在的任何json文件。
最终的输出表应该是这样的。
**tbl1**
col_1 | col_2 | col_3 | partner | customer | model | 发布于 2021-10-26 10:01:29
这是不可能的。
亚马逊雅典娜将自动包括给定location中的所有文件,包括所有子目录中的文件。
发布于 2021-11-03 22:32:01
请检查以下链接以创建表
Selecting specific files for athena
Partition Athena query by S3 created date
创建一个视图,将tbl1中的合作伙伴、客户和模型显示为select ,regexp_extract("$path",'root/(.*)/') partner,regexp_extract(....)客户,regexp_extract(....)来自tbl1的模型
https://stackoverflow.com/questions/69719402
复制相似问题