1

我正在将我的 AWS Glue 连接到外部账户中的 RDS 实例。这些是我的代码,我已经完成了 VPC 对等,打开了所有 TCP 端口和公共可访问性。(我在外部帐户的同一 VPC 中的 MySQL v5 上运行了另一个 rds,并且胶水连接运行顺利)。

import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions 
from pyspark.context import SparkContext, SparkConf 
from awsglue.context import GlueContext 
from awsglue.job import Job 
import time 
from pyspark.sql.types import StructType, StructField, IntegerType, StringType

sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session

df1 = spark.read.format("jdbc")
.option("url", "jdbc:mysql://xxxyyy.rds.amazonaws.com:3306/db")
.option("dbtable", "db_table")
.option("user", "db_dbadmin")
.option("password", "xxxyyy")
.option("driver", "com.mysql.cj.jdbc.Driver")
.load()

df1.show()

此外,我了解 AWS 胶水不支持 Mysql 8 的驱动程序版本,但是,我已将 MySQL v8 jar 文件(在本例中具体为 8.0.11)上传到我的 s3 并授予 IAM 角色 s3 完全访问权限。

不过,我收到了这个错误,我需要帮助

SyntaxError: invalid syntax During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/amazon/bin/runscript.py", line 92, in <module>
while "runpy.py" in new_stack.tb_frame.f_code.co_filename: AttributeError: 'NoneType' object has no attribute 'tb_frame'
4

0 回答 0