我使用 AWS Glue 作为 ETL 将数据加载到 RDS 表,这是一个每日快照表,需要在当天的数据加载之前截断。
我尝试了 DynamicFrameWriter 类中的“Preactions”参数,但看起来它只是 Redshift。
引用:https://aws.amazon.com/premiumsupport/knowledge-center/sql-commands-redshift-glue-job/#
最佳答案
conn = pymysql.connect(<URL>, user=<user_name>, passwd=<password>, db=<db_name>, connect_timeout=30)
print("mysql_connection")
print(conn)
with conn.cursor() as cur:
cur.execute("drop table if exists <tableName>")
conn.commit()
关于amazon-web-services - 如何在数据加载前截断 AWS Glue 作业中的 RDS 表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57077498/