amazon-web-services - 从 S3 存储桶中读取 2 个文件,进行转换,然后将结果写入同一存储桶中的另一个目标文件
问题描述
我有 PySpark 脚本,可以进行一些数据帧转换。我想将它放在 AWS Glue 中,我从 S3 存储桶中的 2 个文件中读取,运行作业/脚本并将结果写入同一存储桶中的另一个文件。我是 AWS 的新手,所以我让 Glue 创建从源读取并指定目标所需的代码行。然而,工作总是失败。我确定问题不在于脚本,因为它在本地完美运行。这是它的样子:
<datasource1> = glueContext.create_dynamic_frame.from_catalog(database = "trial-db", table_name = "tbl1_csv", redshift_tmp_dir = args["TempDir"], transformation_ctx = "<transformation_ctx>")
<datsource2> = glueContext.create_dynamic_frame.from_catalog(database = "trial-db", table_name = "data_txt", redshift_tmp_dir = args["TempDir"], transformation_ctx = "<transformation_ctx>")
#PySpark Transformation script goes here...
<datatarget> = glueContext.write_dynamic_frame.from_options(frame = <frame>, connection_type = "s3", connection_options = {"path":"s3://demo-trial-data/write"}, format = "csv", format_options = <format_options>, transformation_ctx = "<transformation_ctx>")