1

I am connecting my AWS Glue to a RDS instance in external account. These are my code, and I have done VPC peering, open all TCP ports and public accessibility. (i have another rds running on MySQL v5 in the same VPC in external account and the glue connection run smoothly).

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()

In addition, I understand that AWS glue does not support driver version for Mysql 8, however, i have uploaded the MySQL v8 jar file (in this case 8.0.11 to be specific) to my s3 and granted the IAM role s3 full access.

Still, I'm getting this error and i need help

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'
Haoyu Quan
  • 11
  • 1

0 Answers0