将 AWS Glue 连接到 Redshift Serverless Workspace 时出错

问题描述 投票:0回答:1

在进行一些转换后,我正在使用 AWS Glue 将数据从 Glue Catalog 迁移到 Redshift Serverless 和 S3。

自从我学习 Glue 以来,我就使用 Redshift Serverless 来省钱。

所以,我使用了两种方法:-

方法 1:- 可视化 ETL 脚本

这个方法效果很好。我能够将

transformed
文件存储到 S3 和 Redshift Serverless 数据库。表格里充满了数据和所有内容。

方法 2:- 使用 Spark 脚本

当我使用上述脚本(方法1中)创建新的ETL作业时,作业失败。我收到一个错误

An error occurred while calling o86.getSink. The connection attempt failed.
.

这意味着与 Redshift 数据库的连接失败。但是,转换后的 CSV 文件已正确存储到 S3。

我使用的脚本如下:-

ETL 脚本:-

target_Redshift = glueContext.write_dynamic_frame.from_options(
    frame=changeSchema_Transformation,
    connection_type="redshift",
    connection_options={
        "redshiftTmpDir": f"s3://{redshiftTmpDir_s3}/temporary/",
        "useConnectionProperties": "true",
        "dbtable": targer_redshift_dbtable,
        "connectionName": redshift_connection_name,
        "aws-iam-user" : target_iam_role_redshift
        #"preactions": "CREATE TABLE IF NOT EXISTS .......",
    },
    # transformation_ctx="target_Redshift",
)

我假设 Redshift Serverless 未正确配置为与 ETL 作业配合使用,但我看过很多 YouTube 视频,其中 ETL 作业对于 Redshift 集群是成功的。

请帮我解决这个问题!!

amazon-web-services aws-glue amazon-redshift-serverless
1个回答
0
投票

同样的问题也发生在我身上!确保您已将连接添加到作业(Visual ETL 会自动为您完成此操作)

© www.soinside.com 2019 - 2024. All rights reserved.