Saya menemukan cara yang lebih sederhana bekerja dengan koneksi JDBC di Lem. Cara tim Glue merekomendasikan untuk memotong tabel adalah melalui kode contoh berikut saat Anda menulis data ke cluster Redshift Anda:
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")
dimana
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)