从EC2托管的SQLServer到RDS PostGres的AWS粘合

时间:2019-03-28 11:17:00

标签: amazon-web-services amazon-rds aws-glue aws-glue-data-catalog

我们正试图将一小部分数据出于分析目的从主要生产数据库中移出。我认为使用胶水连接服务将很有意义,并且所有JDBC连接设置都没有问题。当我尝试写入RDS终端节点时,AWS Glue作业完成,没有错误传递,并且当我随后使用Dbeaver,DataGrip等进行连接时也没有新表存在。

奇怪的是,当我使用Glue搜寻器连接到目标时,它是表格...

这是由胶水控制台自动生成的一些基本代码

import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job

## @params: [JOB_NAME]
args = getResolvedOptions(sys.argv, ['JOB_NAME'])

sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)

datasource0 = glueContext.create_dynamic_frame.from_catalog(database = "prod", table_name = "datatarget", transformation_ctx = "datasource0")

applymapping1 = ApplyMapping.apply(frame = datasource0, mappings = [("col1", "string", "col2", "string"), ("col3", "string", "col4", "string")], transformation_ctx = "applymapping1")

resolvechoice2 = ResolveChoice.apply(frame = applymapping1, choice = "make_cols", transformation_ctx = "resolvechoice2")

 datasink4 = glueContext.write_dynamic_frame.from_jdbc_conf(frame = resolvechoice2, catalog_connection = "RDS", connection_options = {"dbtable": "targettable", "database": "testdatabase"}, transformation_ctx = "datasink4")

job.commit()

0 个答案:

没有答案