我正在尝试使用胶水流并将数据写入 AWS TimestreamDB,但我很难配置 JDBC 连接。
我遵循的步骤和文档链接如下:https://docs.aws.amazon.com/timestream/latest/developerguide/JDBC.configuring.html
- 我正在将 jar 上传到 S3。这里有多个罐子,我每个都试过。https://github.com/awslabs/amazon-timestream-driver-jdbc/releases
- 在胶水作业中,我将 jar lib 路径指向上述 s3 位置
- 在作业脚本中,我尝试使用 spark/glue 和以下代码从时间流中读取,但它不起作用。有人可以解释我在这里做错了什么吗
这是我的代码:
url = jdbc:timestream://AccessKeyId=<myAccessKeyId>;SecretAccessKey=<mySecretAccessKey>;SessionToken=<mySessionToken>;Region=us-east-1
source_df = sparkSession.read.format("jdbc").option("url",url).option("dbtable","IoT").option("driver","software.amazon.timestream.jdbc.TimestreamDriver").load()
datasink1 = glueContext.write_dynamic_frame.from_options(frame = applymapping0, connection_type = "jdbc", connection_options = {"url":url,"driver":"software.amazon.timestream.jdbc.TimestreamDriver", database = "CovidTestDb", dbtable = "CovidTestTable"}, transformation_ctx = "datasink1")