sql >> Base de Datos >  >> RDS >> Mysql

Sobrescribir tablas MySQL con AWS Glue

Encontré una forma más sencilla de trabajar con conexiones JDBC en Glue. La forma en que el equipo de Glue recomienda truncar una tabla es a través del siguiente código de muestra cuando escribe datos en su clúster de Redshift:

datasink5 = glueContext.write_dynamic_frame.from_jdbc_conf(frame = resolvechoice4, catalog_connection = "<connection-name>", connection_options = {"dbtable": "<target-table>", "database": "testdb", "preactions":"TRUNCATE TABLE <table-name>"}, redshift_tmp_dir = args["TempDir"], transformation_ctx = "datasink5")

donde

connection-name your Glue connection name to your Redshift Cluster
target-table    the table you're loading the data in 
testdb          name of the database 
table-name      name of the table to truncate (ideally the table you're loading into)