gpt4 book ai didi

python - 胶水 etl 作业 - 使用 create_dynamic_frame.from_options 获取 s3 子文件夹

转载 作者:行者123 更新时间:2023-12-04 12:24:41 26 4
gpt4 key购买 nike

我正在创建 AWS Glue ETL 作业,但在文件检索方面遇到了一些障碍。

似乎以下代码仅获取根文件夹 2017 中的文件,而不再获取更多文件。有没有办法在其中包含所有子文件夹和文件?

dyf = glueContext.create_dynamic_frame.from_options(
's3',
{"paths": [
's3://bucket/2017/'
]},
"json",
transformation_ctx = "dyf")

最佳答案

找到了这个问题的解决方案,看起来字典接受更多参数,我需要的是“递归”。您还可以使用“排除项”排除某些模式。

来源 https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-connect.html#aws-glue-programming-etl-connect-s3

dyf = glueContext.create_dynamic_frame.from_options(
's3',
{
"paths": [
's3://bucket/2017/'
],
"recurse" : True
},
"json",
transformation_ctx = "dyf")

关于python - 胶水 etl 作业 - 使用 create_dynamic_frame.from_options 获取 s3 子文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60616004/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com